ServerCertificateValidationCallback() return true but GetResponse() throws an exception

I’ve created a ServerCertificateValidationCallback to check the validity of websites certificates. Testing different URLs there is one case where I give the HttpWebRequest a URL, GetResponse() calls ServerCertificateValidationCallback() and ServerCertificateValidationCallback() does its check and returns true. But even though true is returned, request.GetResponse() still throws an exception which I believe means that there was an issues with the certificate.

        try         {             response = (HttpWebResponse)request.GetResponse();             Stream s = response.GetResponseStream();             sr = new StreamReader(s, Encoding.UTF8);          }         catch (WebException e)         { 

How is it possible that ServerCertificateValidationCallback() returns true but an exception is still being thrown?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.