C#远程Web请求证书错误

发布于 2024-08-25 02:16:13 字数 473 浏览 9 评论 0原文

尝试通过 SSL 向远程服务器执行 HttpWebRequest 时出现以下错误(网址为 https://sandbox .payfast.co.za):

“根据验证程序,远程证书无效”

该证书似乎有效,我可以成功向另一个网址发出网络请求。

有人可以告诉我 .NET 如何验证证书以及如何找出证书的确切问题。

为了尝试绕过这个,我补充道:

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

但这似乎在中等信任度下不起作用。

任何帮助表示赞赏。

谢谢 本

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

汐鸠 2024-09-01 02:16:13

在测试了对其他 url 的一些请求后,我们切换回最初引发证书验证异常的请求,并且它起作用了!

双方都向我保证一切都没有改变。

不管怎样,我发现这篇文章对于进一步诊断问题很有用 http://blogs.msdn.com/jpsanders/archive/2009/09/16/troubleshooting-asp-net -根据验证程序,远程证书无效

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文