日期:2014-05-17 浏览次数:20971 次
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("https://passport.baidu.com/?login");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
// Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close();
// Get response
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
public bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true;
}
//HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("https://passport.baidu.com/?login");之前加入
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult);