Allowing untrusted certificates for assembly/web.config connection
How can I specify that an assembly/web.config based connection should allow untrusted certificates? I get this error when trying to connect to a server that has a certificate that isn't trusted:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)
A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)
Comments
System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender,cert,chain,errors) => { return true; };
Note: this would be a bad thing in production. You are better off solving the issue of importing the correct certificates so things just work, or at least inspecting the certificates in your callback and matching them against a known good copy.