The solution is to ignore the invalid cert. (Reference from http://blog.degree.no/2012/02/accepting-invalid-ssl-certificates-programmatically-c/)
// method where request is made // ensure SSL certificate validation uses custom method ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(CustomCertificateValidatior); // initiate a SOAP or HTTP request like normal // and your custom method will be used for validation // ..
// callback for validating SSL certificate during handshake private static bool CustomCertificateValidatior(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors policyErrors) { // anything goes! return true; // PS: you could put your own validation logic here, // through accessing the certificate properties: // var publicKey = certificate.GetPublicKey(); }
No comments:
Post a Comment