• Ask a Question
  • Create a Poll
150
    Ask a Question
    Cancel
    150
    More answer You can create 5 answer(s).
      Ask a Poll
      Cancel

      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?

      0 Answers