C#远程Web请求证书错误
尝试通过 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在测试了对其他 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