且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C# 通过 SSL/TLS 获取 xml 站点 - https://

更新时间:2022-04-16 02:55:05

对于证书问题,请尝试以下...

For the certificate issue try the following...

ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback((s, ce, ch, ssl) => true);

...在开始的某个地方 - 或在执行请求之前.

...somewhere at the start - or before doing the request.

这基本上是无条件地验证任何证书,有点简化.

That's basically validating any certificate unconditionally, a bit simplified.

这是盲目"信任(并且对您的应用程序具有全局特性)-正确的实施将处理参数-或需要实施 ICertificatePolicy 专门处理不同的主机/证书.

that's 'to blindly' trust (and is of global character for your app) - proper implementation would handle the parameters - or entails implementing ICertificatePolicy to specifically deal with different hosts/certificates.

编辑(证书):关于证书和 SSL 的实际工作方式 - 与上述相关(基于评论/讨论)......

EDIT (certificates): as to how the certificates and SSL actually work - and related to the above (based on the comments/discussion)...

http://www.verisign.com/ssl/ssl-information-center/how-ssl-security-works/index.html
SSL 究竟是如何工作的?
https://superuser.com/questions/84572/public-key-encryption