2

I have an .NET application that interacts with a SOAP web service in our test and production environment.The test environment requires TLS 1.1 or above whereas production still supports TLS 1.0.

I have added this following code:

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 |    
                                                   SecurityProtocolType.Tls11 | 
                                                   SecurityProtocolType.Tls;

Does anyone know if the above piece of code will work in both test and production environments by using the supported encryption protocol? Thanks

Harish
  • 270
  • 3
  • 11

1 Answers1

0

The answer depends on your version of .NET. If you have .NET 4.5 installed it will work, even if your code is compiled against 4.0.

If you don't have 4.5+ installed it will not work. See http://blogs.perficient.com/microsoft/2016/04/tsl-1-2-and-net-support/ for more details.

Branhap
  • 21
  • 1
  • SecurityProtocolType.Tls11 and SecurityProtocolType.Tls12 do not exist in .NET 4.0 so you would not be able to compile it against that framework. It would need to target .NET 4.5. There is a workaround but I don't think it is a good approach: http://stackoverflow.com/a/28333370/5844190 – Alsty Oct 26 '16 at 11:08