user1760129
user1760129

Reputation: 153

How to handle HttpWebRequest C# with Tls 1.3

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.

Upvotes: 15

Views: 43768

Answers (1)

Ricky Keane
Ricky Keane

Reputation: 1700

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

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

However it is only supported on newer Window's OS versions (windows 11 and server 2022+), see here for full support details.

Upvotes: 14

Related Questions