C # web request certificate error

I get the following error when trying to execute HttpWebRequest on a remote server via SSL (url https://sandbox.payfast.co.za ):

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

The certificate is valid and I can successfully make a web request to a different URL.

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

To try and get around this, I added:

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

But it seems that this will not work in conditions of trust in the environment.

Any help was appreciated.

Thanks Ben

+4
source share
1 answer

After testing a few requests for a different URL, we returned to the one that initially raised the certificate verification exception and it will work!

Both sides guarantee that nothing has changed.

Anyway, I found this post helpful for further troubleshooting http://blogs.msdn.com/jpsanders/archive/2009/09/16/troubleshooting-asp-net-the-remote-certificate-is-invalid-according -to-the-validation-procedure.aspx

+3
source

Source: https://habr.com/ru/post/1304086/


All Articles