WebClient 指定安全协议(Tls1.1,Tls1.2,Tls1.3)

WebClient 指定安全协议(Tls1.1,Tls1.2,Tls1.3) 

try
{
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13; 
    var client = new WebClient();
    var bytes = client.DownloadData("https://xxx");
}
catch (Exception ex)
{
    throw;
}

 

posted on 2021-07-15 09:56  大豆男生  阅读(467)  评论(0编辑  收藏  举报

导航