IE里会提示否仍然继续的那种
public string RequestHttps(string url){
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidationResult);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string encoding = response.ContentEncoding;
if (encoding == null || encoding.Length < 1)
{
encoding = "UTF-8"; //默认编码
}
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
var content = reader.ReadToEnd();
response.Close();
return content;
}
bool ValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true; //总是接受以防报证书错
}