If you are here than you might be the one of us wondering how to enable TLS 1.2 on Framework 4.0, right? It was the crazy couple of a month ago when all payment gateway did enforce the security standard to TLS 1.2.

There were systems which were built in .Net Framework 4.0 and enforcing to enable  TLS 1.2 was a bit tricky there.

The only way I have found to change this is directly on the code.

Here is the one-liner that fixes TLS 1.2 issue. Add this in Global.asax, and you are good to go!(Ref)

ServicePointManager.SecurityProtocol = (SecurityProtocolType) 3072;

We are all set 🙂 Happy coding.

If you liked this article, then please subscribe to our Blog for more updates like this. You can also connect me on Twitter, LinkedIn and GitHub.