码迷,mamicode.com
首页 > 其他好文 > 详细

偶尔遇到的“The request was aborted:Could not create SSL/TLS secure channel.”怎么解决?

时间:2017-07-01 00:59:21      阅读:330      评论:0      收藏:0      [点我收藏+]

标签:ann   eval   remote   string   protocol   ice   poi   替换   div   

if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))///https请求
{
    ServicePointManager.Expect100Continue = true;
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls; //SSL3协议替换成TLS协议
    ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
    webRequest = WebRequest.Create(url) as HttpWebRequest;
    webRequest.ProtocolVersion = HttpVersion.Version10;
}
else
{
    webRequest = WebRequest.Create(url) as HttpWebRequest;
}

偶尔遇到的“The request was aborted:Could not create SSL/TLS secure channel.”怎么解决?

标签:ann   eval   remote   string   protocol   ice   poi   替换   div   

原文地址:http://www.cnblogs.com/only-yu/p/7101102.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!