Reputation: 67223
If I want to crawl a site which has SSL certificates, how can I do this?
I know there is the WebClient
class in C# and HttpWebRequest
/HttpWebResponse
but what changes would I need to make?
Upvotes: 2
Views: 530
Reputation: 39695
Just add this at the top of your application
ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, X509Certificate certifcate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
};
This will make HttpWebRequest accept any certificates from the servers.
Upvotes: 1
Reputation: 41929
You do not need to change anything, except the url which should start with "https" instead of "http".
Upvotes: 3