【发布时间】:2012-10-19 07:13:50
【问题描述】:
我正在调用我们的服务器,它将检查用户的身份验证,如果是有效用户,它将返回一个会话 ID。服务器的url是https...
我已经对服务器进行了 httpwebrequest 调用(以及尝试过的 webclient)。它工作正常,但最近服务器的证书已更新,现在我无法访问服务器。它抛出异常服务器不是找到了……
下面是我的代码......
private void LoginRequest()
{
try
{
var httpLoginRequest = (HttpWebRequest)WebRequest.Create(new Uri("https:xxxxx" + "?" +"username=" + UserName_textBox.Text + "&" + "password="+ Password_textBox.Password));
httpLoginRequest.Method = DisplayMessage.Get_Method;
Parameters = new Dictionary<string, string>();
httpLoginRequest.BeginGetResponse(new AsyncCallback(GetLoginCallback), httpLoginRequest);
}
catch (Exception ex)
{
throw ex;
}
}
private void GetLoginCallback(IAsyncResult asynchronousResult)
{
try
{
HttpWebRequest httpRequest = HttpWebRequest)asynchronousResult.AsyncState;
HttpWebResponse httpresponse = (HttpWebResponse)httpRequest.EndGetResponse(asynchronousResult);
Stream streamResponse = httpresponse.GetResponseStream();
using(StreamReader streamRead = new StreamReader(streamResponse))
{
var response = streamRead.ReadToEnd();
}
}
catch(WebException ex){}}
我推荐了很多论坛,但似乎没有用。
【问题讨论】:
标签: .net windows-phone-7-emulator