WebClient + HTTPS Issues

Solution 1:

The shortest notation of the code to allow all certificates is actually:

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

And works well for this error. Needless to say that you should provide an implementation which actually checks the certificate and decides based on the certificate information if the communication is safe. For test purposes, use the above line of code.

Solution 2:

For the VB.NET version of the original answer, here you go (converters don't work well when needing to wire up events with the 'AddressOf' operator). 1st code that goes before using a WebClient() or HttpWebRequest() object:

ServicePointManager.ServerCertificateValidationCallback = New System.Net.Security.RemoteCertificateValidationCallback(AddressOf bypassAllCertificateStuff)

..and the wired up method code:

Private Shared Function bypassAllCertificateStuff(ByVal sender As Object, ByVal cert As X509Certificate, ByVal chain As X509Chain, ByVal [error] As System.Net.Security.SslPolicyErrors) As Boolean
    Return True
End Function