You need to make sure that the
ServicePointManager
settings (TLS/SSL based) are done before the
HttpWebRequest
is created.
Try like:
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12
| SecurityProtocolType.Ssl3;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.codeproject.com/api/")