访问https网站时出现错误:请求被中止: 未能创建 SSL/TLS 安全通道。

解决方法:在创建HttpWebRequest之前创建ServicePointManager
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
public string BrowseRequest(string url)
{
string result = "";
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.Timeout = 5000;
request.ContentType = "application/x-www-form-urlencoded";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
result = sr.ReadToEnd();
}
}
return result;
}