Click here to Skip to main content
15,886,724 members
Articles / Web Development / ASP.NET
Tip/Trick

How to work with SSL-protected sites

Rate me:
Please Sign up or sign in to vote.
4.90/5 (3 votes)
22 Mar 2011CPOL 10.6K   6   2
HTTPS
If you deal with SSL-protected sites a couple of methods can be useful:

C#
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Belarus Belarus
Software developer with over 3 years of extensive experience in analysis, design and development. Recently, most interested in refactoring and design patterns applied to .NET Framework.

Core technologies I am using: OOP, OOD, DDD, TDD, N-tier applications, enterprise development.

Certificates:
Brainbench: .NET Framework 3.5 Fundamentals, Data Modeling Concepts, Web Design Concepts, C#

Microsoft: Exam 70-526: TS: Microsoft .NET Framework 2.0 - Windows-Based Client Development

INTUIT.RU: Development of Web-application ASP. NET Using Visual Studio. NET, Web applications in ASP.NET, Microsoft .NET Framework Distributed Applications Development.

Specialties
NET Framework : 2.0, 3.5, 4.0
Languages and technologies: C#, ASP.NET MVC 2, ASP.NET MVC 3, WCF, ASP.NET 4.0, Web Services, ADO.NET, LINQ, Entity Framework, NHibernate 3.0, JavaScript, HTML, CSS, XML, Ajax
RDBMS : SQL Server 2005, 2008, 2008 R2, MS Access.
Reporting: MS SQL Reporting Services, Crystal Reports

Comments and Discussions

 
GeneralSee also: http://west-wind.com/Weblog/posts/48909.aspx Pin
Richard Deeming30-Mar-11 10:03
mveRichard Deeming30-Mar-11 10:03 
GeneralVery useful. Pin
a_motallebi29-Mar-11 0:19
a_motallebi29-Mar-11 0:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.