How to handle HttpWebRequest C# with Tls 1.3

北城以北 提交于 2020-06-28 07:58:32

问题


I am unable to connect to an HTTPS server (TLS 1.3) using WebRequest because of this error message:

The request was aborted: Could not create SSL/TLS secure channel.

The previous TLS version was 1.2 and with below code I could GET the page properly but as the page ssl upgraded to TLS 1.3 I got the error and also I cannot find any solution about it:

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

In fact, I think it should be something like below:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13;

but there is not.


回答1:


It looks like TLS13 is supported now as part of the 4.8 .Net Framework

https://docs.microsoft.com/en-us/dotnet/api/system.net.securityprotocoltype?view=netframework-4.8



来源:https://stackoverflow.com/questions/55240173/how-to-handle-httpwebrequest-c-sharp-with-tls-1-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!