Home > DeveloperSection > Blogs > Viewing Client Certificate.

Viewing Client Certificate.

ASP.Net ASP.Net 
0 Comment(s)
 2887  View(s)
Rate this:

With the help of this program we can view Client Certificateand user name. In this demonstration we check whether client system has anappropriate certificate or not.  

public voiddisplayCeartificate()


        string userName = User.Identity.Name;   //Get Client Nameas Identity

       Response.Write("Hello User  : " + userName + "<br />");  // Display AMessage To User.

        HttpClientCertificate cert =Request.ClientCertificate;  //Create an HttpClientCeartificate object.

        if (cert.IsPresent) //Check Whether Certificate Exist Or Not.


           Response.Write(cert.Get("SUBJECT0"));  //If Exist Then Write Certificate Message.




           Response.Write("No CeartificateFound.");  //Other Wise Display No Certificate Found.



Don't want to miss updates? Please click the below button!

Follow MindStick