0

I'm trying to force a website to use TLS1.2 with the following code:

        if (ServicePointManager.SecurityProtocol.HasFlag(SecurityProtocolType.Tls12) == false)
        {
            ServicePointManager.SecurityProtocol = ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls12;
        }

The site will compile and run, however whenever I log in which sends a HttpWebRequest.GetResponse to a webservice, I get the following error.

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

How can I get round this issue? Everything I can see on online suggests that the above code should fix this, but in my case it doesn't.

Cheers

  • does the remote website actually support TLS 1.2? Does the machine you're running this code from support it? It's not just a case of a code change, the machines which are communicating both need to have support for the protocol installed and configured, too. – ADyson Mar 04 '19 at 09:57
  • The ciphers on the web server have been amended to use TLS1.2 only. This has been done by support, not myself. I am unsure if the remote website actually supports TLS1.2. How could I check? Thanks for the reply. I've had support switch off ciphers and tell to make the site compatible. –  Mar 04 '19 at 10:15
  • "How could I check?" ... I suggest asking the people who maintain it – ADyson Mar 04 '19 at 10:26
  • Cheers, I've sent an email to their support team to find out. Just wondered if there was any means of debugging to see exactly where the issue is stemming from. Cheers all the same –  Mar 04 '19 at 11:29

0 Answers0