title: ASP.NET - Help Testing & Debugging PKI Authentication
body: <p>I am working on an ASP.NET WebForms application, and I have been asked to switch from Windows Form Authentication to PKI Certificate Authentication; something I know very little about.</p>
  
  <p>After reviewing various web posts and their code snippets, I thought I knew enough to at least begin sniffing a PKI Certificate (or any client certificate for that matter).  Specifically I am using:</p>
  
  <pre><code>X509Certificate2 cert = new X509Certificate2(Page.Request.ClientCertificate.Certificate);
  X500DistinguishedName dn = cert.SubjectName;
  </code></pre>
  
  <p>So I put a breakpoint on the 2nd line, hit F5 from Visual Studio.  Debugging starts, but 'cert' is always null.  I then realize that I have no Personal certs on my computer, so I download the Firefox add-on Key-Manager, create a dummy certificate, and try again with the same result, 'cert' is always null.  </p>
  
  <p>So then, I start screwing around with the command-line tool makecert, but still 'cert' is always null.</p>
  
  <p>I am using IIS Express 7.5 for debugging purposes, tried both http and https.</p>
  
  <p>What do I need to do to attach the personal cert to any web requests, and have them get picked up by my ASP.NET application?</p>