GurdeepS
GurdeepS

Reputation: 67223

Crawling a secure site

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

Answers (2)

Mikael Svenson
Mikael Svenson

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

Espo
Espo

Reputation: 41929

You do not need to change anything, except the url which should start with "https" instead of "http".

Upvotes: 3

Related Questions