Hello,
today I encountered the following error:
Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure. |
In my Code I opened a WebClient an tried to download a file from an https website.
You get the error when you try to open a page with invalid or self signed certificate.
Maybe you already know this error from your web browser.
To ignore this certificate error just add the following code:
ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true; |
Now all certificates are marked as valid.
Posted
May 18 2015, 01:20 PM
by
Holger Vetter