Realizando un “robot” que accede un URL utilizando Net.HttpWebRequest sobre https que no tiene un certificado de una autoridad certificadora me tope con el siguiente error:
System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
Solución:
Sólo se debe agregar la siguiente línea.
ServicePointManager.ServerCertificateValidationCallback = Function(sender As Object, certificate As X509Certificate, chain As X509Chain, sslPolicyErrors As System.Net.Security.SslPolicyErrors) True
Es importante agregar los siguientes includes:
Imports System.Security.Cryptography.X509Certificates
Imports System.Net.Security.SslPolicyErrors