title: Read smart card on demand
body: <p>I am making an application in which a user would see a login page, enter his email address and a password.  At that time I want the system to read his CAC certificates and permit him to choose.  Right now all I can do is require the SSL and it asks for the certificate before the user logs in.  Is there any way to do this?  I am testing this locally with VS 2015 and changing the applicationhost.config file.  I am not sure how it will function differently on a server at this point.  Basically, I want to ask the user for a certificate when I need it and not before.</p>
  
  <p>I found some data but it still doesn't work on the server.  I changed the SSL settings on the server to not require SSL and to ignore.  Then I added this to my web.config file:</p>
  
  <pre><code> &lt;location path="FileSharing/Index" allowOverride="true"&gt;
  &lt;system.webServer&gt;
    &lt;security&gt;
      &lt;access sslFlags="Ssl,SslNegotiateCert,SslRequireCert"/&gt;
    &lt;/security&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p></p>
  
  <p>With this I am getting a 500 error and the browser is trying to go to:</p>
  
  <p><a href="https://server/FileSharing/FileSharing/Index">https://server/FileSharing/FileSharing/Index</a></p>
  
  <p>where the FileSharing is in the address twice.  Any ideas?</p>
  
  <p>The first page, which is simply a welcome page and does not require SSL, comes up fine but I want it to read the cert when going to the Index.</p>