Tuesday, 21 June 2016

The request was aborted: Could not create SSL/TLS secure channel.

If you got the error like this The request was aborted: Could not create SSL/TLS secure channel when you want to get response from HttpWebrequest object.

Here is simple solution just put below line before getting httpWebResponse.

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

if TLS 1.2 is not working then you can also write down as below.

   ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072;
            ServicePointManager.Expect100Continue = true;