Tuesday 24 January 2017

Change the protocol before calling any URL using HttpWebRequest

Now-a-days most of secure websites has transferred their security protocol to TLS 1.2 protocol. In C#, default protocol is taken as SSL3 or TLS. You must need to change this protocol before accessing secure website with TLS 1.2 protocol. Just write below code before you call targeted website.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

This code will change the calling request protocol to TLS 1.2. That’s it

No comments:

Post a Comment