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.
}
}
Anonymous User
11-Mar-2019Thank You for sharing.