When I connect to an HTTPS server using WebRequest, I am facing an error.
The request was aborted: Could not create SSL/TLS secure channel.
I used this code to bypass this error:
private void Somewhere() {
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(AlwaysGoodCertificate);
}
private static bool AlwaysGoodCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors policyErrors) {
return true;
}
The server never validates the certificate and fails with the above error. Does anyone have any idea of what I should do?