Users Pricing

blog

home / developersection / blogs / viewing client certificate.

Viewing Client Certificate.

Anonymous User 4330 18 Feb 2011 Updated 18 Sep 2014

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.
        }
}


I am a content writter !


1 Comments