C# remote web request certificate error
Asked Answered
K

1

6

I am getting the following error when trying to perform a HttpWebRequest to a remote server over SSL (the url is https://sandbox.payfast.co.za):

"The remote certificate is invalid according to the validation procedure"

The certificate seems to be valid and I can successfully make a web request to another url.

Could someone tell me how the .NET validates the certificate and how I can find out the exact problem with the certificate.

To try and bypass this I added:

        ServicePointManager.ServerCertificateValidationCallback 
        = (obj, certificate, chain, errors) => true;

But it seems this will not work in medium trust.

Any help appreciated.

Thanks Ben

Kaitlin answered 14/3, 2010 at 19:52 Comment(0)
K
3

After testing testing a few requests to other url's we switched back to the one originally raising the certificate validation exception and it worked!

Both parties ensure me nothing was changed.

Either way, I found this post useful in trying to diagnose the problem further http://blogs.msdn.com/jpsanders/archive/2009/09/16/troubleshooting-asp-net-the-remote-certificate-is-invalid-according-to-the-validation-procedure.aspx

Kaitlin answered 22/3, 2010 at 10:33 Comment(1)
The link is dead.Personate

© 2022 - 2024 — McMap. All rights reserved.