WebExceptionStatus.TrustFailure

  • Thread starter Thread starter Development
  • Start date Start date
D

Development

I developed a class library in vb.net to post an httprequest to a remote
server and before accepting the results I validate the certificate that was
returned. Everything works fine when I use a windows form to test the app,
but if I call the class library from an asp.net page I get the error
"WebExceptionStatus.TrustFailure" when I try to validate the certificate. I
don't know what I am missing here.

This is the code I am using to validate the Certificate

Try

'get the response from the internet resource webRes =
CType(webReq.GetResponse, HttpWebResponse) Catch e As WebException If
e.Status = WebExceptionStatus.TrustFailure Then

ValidateCertificate = ExperianCertificateValidation.CertErrorMessage

ExperianCertificateValidation.CertErrorMessage = ""

ElseIf e.Status = WebExceptionStatus.Timeout Then

ValidateCertificate = e.Message & vbCrLf & e.StackTrace Else

ValidateCertificate = "An error ocurred please contact MIS." & vbCrLf &
e.StackTrace End If Catch ex As Exception ValidateCertificate = ex.Message &
vbCrLf & ex.StackTrace End Try
 
Back
Top