I just encountered situation where I had to request a page with SSL error.

By default, HttpWebRequest won’t process any request if SSL is invalid but you can override this setting with just one line of code to ignore all SSL error (basically trust all SSL without checking, could be unsafe too).

VB.net

ServicePointManager.ServerCertificateValidationCallback = (Function(sender, certificate, chain, sslPolicyErrors) True)

C#

ServicePointManager.ServerCertificateValidationCallback =((sender, certificate, chain,
sslPolicyErrors) => true); 

Leave a reply