65.9K
CodeProject is changing. Read more.
Home

How to work with SSL-protected sites

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.90/5 (3 votes)

Mar 22, 2011

CPOL
viewsIcon

11341

HTTPS

If you deal with SSL-protected sites a couple of methods can be useful:
public void ConfigureSSL()
{
    ServicePointManager.ServerCertificateValidationCallback = CertChecker;
}

private bool CertChecker(object sender, X509Certificate certificate,
                    X509Chain chain, SslPolicyErrors errors)
{
    return certificate.Subject == "Certificate Subject for required site";
}
Call ConfigureSSL() before to request some page.