C# - ungültiges SSL-Zertifikat ignorieren
Um mal schnell eine SSL/TLS-Datenübertragung zu testen, ist es praktisch, wenn man ein ungültiges SSL-Zertifikat auch mal ignorieren kann. Mit diesem Code hier geht das:
using System.Net;
...
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback
(IgnoreCertificateErrorHandler);
...
private bool IgnoreCertificateErrorHandler
(object sender,
System.Security.Cryptography.X509Certificates.X509Certificate certificate,
System.Security.Cryptography.X509Certificates.X509Chain chain,
System.Net.Security.SslPolicyErrors sslPolicyErrors)
{
return true;
}
...
Quelle:
http://en.csharp-online.net/Invalid_HTTPS_certificate