14

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.

user1760129
  • 143
  • 1
  • 1
  • 7
  • I'm pretty sure that TLS 1.3 is not currently supported with SChannel (Windows TLS stack) and therefore also not with C#. But it would be a fool or have very special requirements who accepts exclusively TLS 1.3 today since support in commonly used libraries is still lacking. I rather suspect that your problem is something different but you don't provide enough information. – Steffen Ullrich Mar 19 '19 at 13:30
  • Thanks. I tried all SecurityProtocolType and I got an error for all of them. I want to GET a web page which has TLS 1.3. what further information do you need? – user1760129 Mar 19 '19 at 18:49
  • I mean I tried these: ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3; – user1760129 Mar 19 '19 at 18:55

1 Answers1

11

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.

jkdba
  • 2,378
  • 3
  • 23
  • 33
Ricky Keane
  • 1,540
  • 2
  • 15
  • 21
  • 5
    4.8 declares the `SecurityProtocolType.Tls13` constant. Unfortunately, as .NET uses Schannel, the TLS 1.3 is not supported yet. According to https://learn.microsoft.com/en-us/windows/win32/secauthn/protocols-in-tls-ssl--schannel-ssp-#tls-protocol-version-support, it should support TLS 1.3 on Windows Server 2022. – Simon Rozman Apr 07 '21 at 13:29
  • am facing a similar issue in some random Windows 7 machines. So If my .net app is upgraded to 4.8 version, would it be stable making the httprequests successfull? – user1 Jun 09 '21 at 17:01