C# Get xml site over SSL/TLS - https://

江枫思渺然 提交于 2019-11-30 16:31:44
NSGaga

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.

EDIT: 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.

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
How does SSL really work?
https://superuser.com/questions/84572/public-key-encryption

Rob Rodi

You'll have to send an HttpWebRequest or use HttpClient. Both of which are designed for making/negotiating these connection.

Possible Dupe: How to load xml from https using XmlTextReader

How do I use WebRequest to access an SSL encrypted site using https?

HttpWebRequest with https in C#

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!