title: How to detect which security protocol (SSL/TLS) is to be used for rest webservice call?
body: <p>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 <code>The request was aborted: Could not create SSL/TLS secure channel.</code> 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.</p>
  
  <pre><code>ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
  ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
  </code></pre>
  
  <p>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?</p>