3

I am developing a winform application in which I make calls to REST webservices. For http based web servers it works fine.But,when it was used for a https based server, they recieved an exception The request was aborted: Could not create SSL/TLS secure channel. Apparently, this is happening because they are using TLS v1.2 and I have not specified which version of protocol is to be used during webservice call.And, when I searched on internet found that adding the following code will do the job.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

But what if some other server uses different version of security protocol.How do I make the code robust, so that it detects the protocol being used and then sets the configuration accordingly?

Robert
  • 39,162
  • 17
  • 99
  • 152
V K
  • 1,645
  • 3
  • 26
  • 57
  • Provide multiple values as shown here: [Default SecurityProtocol in .NET 4.5](http://stackoverflow.com/questions/28286086/default-securityprotocol-in-net-4-5) – Robert May 13 '16 at 14:32

0 Answers0