Windows Phone 8.1和Windows窗体中C#之间的区别???
C#代码在Windows窗体中运行良好!
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
public static string ConnectSSL(string url)
{
url = "https://203.113.167.1/CMCSoft.IU.Web.info/login.aspx";
WebRequest request = WebRequest.Create(url);
request.Proxy = null;
request.Credentials = CredentialCache.DefaultCredentials;
//allows for validation of SSL certificates
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(ValidateServerCertificate);
ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
return responseFromServer;
}
public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}
但是对于Windows Phone 8.1,缺乏使用它:
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
如何在Windows Phone 8.1上运行程序? 感谢所有的帮助!