blog

Home / DeveloperSection / Blogs / Viewing Client Certificate.

Viewing Client Certificate.

Anonymous User3935 18-Feb-2011

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.
        }
        else
        {
           Response.Write("No CeartificateFound.");  //Other Wise Display No Certificate Found.
        }
}


Updated 18-Sep-2014
I am a content writter !

Leave Comment

Comments

Liked By