Sample: Smart Card AuthN / AuthZ in ASP.NET

10:28 AM j. montgomery 5 Comments

UPDATE: An updated version is out. Read more about it here.

I have finally posted the C# code samples for the Smart Card HTTP Handler. See Implementing SmartCard Authentication with ASP.NET for the full article. A PDF version is included in the sample download package.

This sample code demonstraites how to implement authentication and authorization in ASP.NET with Smart Card (or Client Certificates) by:

  1. Implementing a custom Smart Card Aware HTTP Authentication Module for .NET

  2. Building an IPrincipal and IIdentity to use with ASP.NET for Smart Card Authenticaiton Http Module

You can download the Sample code in C# here.


  1. This was really good code, but we're strictly a VB .Net shop and need something simpler. Can anyone tell me where to get a sample of code that reads a client cert back from the IIS 6 server and returns the Issued To String? Thanks!

  2. Read through the attached PDF file that comes with the C# code - it has most of the code in both C# and VB.Net for much of the smart card implementation.

    Sadly I haven't had a chance to get out the VB.Net sample code. If you don't see what you need in the PDF, let me know.

  3. Thank you for this article. It addresses perfectly what I am currenty tasked with. However, the links to the source code and the .pdf version of the article don't work. I saw in a later post you're working on a version 2, but I'd be happy with the first version for now. Any chance to can update those links?

  4. Glad you found it helpful! Thanks for letting me know the links died. We just went through a site upgrade.

    Try again, you should be able to download them now.

  5. links dead - are you and this project still alive? Would very much appreciate a refresh for the downloads - nice work.