[SalesForce] TLS 1.2 Using Partner wsdl

I have been using the Partner wsdl to connect to SalesForce from my C# application for a few years. When I found out that SalesForce was turning off TLS 1.0, I did some reading and found out that updating my C# application to the .NET 4.6 Framework should get it to use TLS 1.1 or TLS 1.2, so problem solved? No.

When I run a Login History report in SalesForce, my application looks like it is still using TLS 1.0. I can't seem to figure out why.

I rebuilt my application from scratch on .NET 4.6 thinking that maybe when I upgraded there was something hanging around forcing TLS 1.0. The login history report in SalesForce still reports that my app is using TLS 1.0.

I've downloaded the latest version of the Partner wsdl and that didn't fix anything either.

Any help would be greatly appreciated.

Best Answer

You can force you C# application to only use TLS 1.2 by adding the following line before making the connection to Salesforce:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

In general usage you would typically include a | SecurityProtocolType.Tls11 with that line as well.

If it still isn't working, check the operating system level support for TLS 1.2 as well. For instance, Windows Server 2012 and earlier and Windows 8 and earlier may not support TLS 1.1 and higher unless IE 11 is installed. See Salesforce disabling TLS 1.0

Related Topic