.net https抛出;“找不到远程服务器”;WindowsPhone7
Iam正在呼叫我们的服务器,它将检查用户的身份验证,如果用户有效,它将返回会话ID。服务器的url是https 我已对服务器进行了httpwebrequest调用(以及尝试的webclient)。它工作正常,但最近服务器的证书已续订,现在我无法访问服务器。。它抛出一个找不到的异常服务器 下面是我的代码.net https抛出;“找不到远程服务器”;WindowsPhone7,.net,windows-phone-7-emulator,.net,Windows Phone 7 Emulator,Iam正在呼叫我们的服务器,它将检查用户的身份验证,如果用户有效,它将返回会话ID。服务器的url是https 我已对服务器进行了httpwebrequest调用(以及尝试的webclient)。它工作正常,但最近服务器的证书已续订,现在我无法访问服务器。。它抛出一个找不到的异常服务器 下面是我的代码 private void LoginRequest() { try { var httpLoginRequest
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){}}
private void LoginRequest()
{
尝试
{
var httpLoginRequest=(HttpWebRequest)WebRequest.Create(新Uri(“https:xxxxx”+“?“+”username=“+username\u textBox.Text+”&“+”password=“+password\u textBox.password));
httpLoginRequest.Method=DisplayMessage.Get\u方法;
参数=新字典();
httpLoginRequest.BeginGetResponse(新的异步回调(GetLoginCallback),httpLoginRequest);
}
捕获(例外情况除外)
{
掷骰子;
}
}
私有void GetLoginCallback(IAsyncResult asynchronousResult)
{
尝试
{
HttpWebRequest httpRequest=HttpWebRequest)asynchronousResult.AsynchState;
HttpWebResponse httpresponse=(HttpWebResponse)httpRequest.EndGetResponse(异步结果);
streamResponse=httpresponse.GetResponseStream();
使用(StreamReader streamRead=新StreamReader(streamResponse))
{
var response=streamRead.ReadToEnd();
}
}
catch(WebException ex){}
我参考了许多论坛,但似乎没有用。问题是因为服务器证书已更改。。。。。因此,我需要手动安装ssl证书。。。。我通过在我的移动浏览器中通过邮件下载ssl证书url作为附件并安装它来实现这一点