C# .NET HttpWebRequest 显示指定SSL TLS 版本

发布时间 2023-07-06 10:08:55作者: runliuv

C# .NET HttpWebRequest 显示指定SSL TLS 版本

 

在程序启动时加入这段代码:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

 

ServicePointManager.SecurityProtocol 是全局控制,不需要每次请求都指定。