I got TLS 1.0 disabled. So we are trying to use TLS 1.2 in our .Net application which is using .Net Framework 4.0.
I have added the code for this at the start
System.Net.ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
It works perfectly on my local system.
But i am not sure why its not working when I deploy the code on server (Windows Server 2008 R2). I checked everything. .Net framework is present on server. But still its giving the same issue on server only.
Is there anything I'm missing here?
According to this post:
.NET 4.0supports up toTLS 1.0while.NET 4.5supports up toTLS 1.2However, an application targeting
.NET 4.0can still support up to TLS 1.2 if .NET 4.5 is installed in the same environment..NET 4.5installs on top of.NET 4.0, replacingSystem.dll.
So basically you need to upgrade your server to .Net 4.5 to enable TLS 1.2.
Also, you can simplify your code and make it more readable:
using System.Net;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Related MSDN articles:
SecurityProtocolType enum for .Net 4.0 (no Tls12 member here)SecurityProtocolType enum for current .NetIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With