I am trying to read an X509 certificate using Request.ClientCertificate but nothing is returned. The certificate is definitely being attached to the request because I can get the certificate information from the page sending the request.
I have tried reading the certificate from several different places but cannot seem to get it to work.
I started with code from this KB Article. In the requested page I tried to print out some information about the certificate but nothing was returned in the response.
This is running on IIS 5.1 and the communication is over SSL. This must be done using version 2 of the .Net framework
Why does the certificate seem to dissappear?
I wrote a identification web page a while back that looked for a client certificate and if found would display the certificate information. I believe that is what you are looking for... Here is the page:
I'm not sure what you need the client certificate for, but if you're using it for your own custom authentication or authorization, you may want to consider using the web server's security infrastructure instead of implementing your own. For example, you can configure IIS to require client certificates, map the certs to user accounts, and use Windows-based authentication. Of course, this doesn't necessarily work for your problem domain.
You have to configure your local IIS to accept (or require) client certificates.
Ok it isn't completely clear but you have a website which requires the clients to authenticate themselves using certificates? Because thats what the
Request.ClientCertificate
property is for.I say this because there's something odd about your question.
"I can get the certificate information from the page sending the request."
Pages in general do not really send requests the clients do.
To get the server cert you could open the X509Store and sift through the certs to find the one with the CN you need.