我正在调用我们的服务器,它将检查用户的身份验证,如果是有效用户,它将返回一个会话 ID。服务器的网址是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){}}
我已经参考了很多论坛,但似乎没有用。