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