HttpRequest.ClientCertificate Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the current request's client security certificate.

Namespace:   System.Web
Assembly:  System.Web (in System.Web.dll)

public HttpClientCertificate ClientCertificate {
	[AspNetHostingPermissionAttribute(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Low)]
	get;
}

Property Value

Type: System.Web.HttpClientCertificate

An HttpClientCertificate object containing information about the client's security certificate settings.

The following code example sends the client's certificate settings back to the client in an HTML page.

HttpClientCertificate cs = Request.ClientCertificate;

Response.Write("ClientCertificate Settings:<br>");
Response.Write("Certificate = " + cs.Certificate + "<br>");
Response.Write("Cookie = " + cs.Cookie + "<br>");
Response.Write("Flags = " + cs.Flags + "<br>");
Response.Write("IsPresent = " + cs.IsPresent + "<br>");
Response.Write("Issuer = " + cs.Issuer + "<br>");
Response.Write("IsValid = " + cs.IsValid + "<br>");
Response.Write("KeySize = " + cs.KeySize + "<br>");
Response.Write("SecretKeySize = " + cs.SecretKeySize + "<br>");
Response.Write("SerialNumber = " + cs.SerialNumber + "<br>");
Response.Write("ServerIssuer = " + cs.ServerIssuer + "<br>");
Response.Write("ServerSubject = " + cs.ServerSubject + "<br>");
Response.Write("Subject = " + cs.Subject + "<br>");
Response.Write("ValidFrom = " + cs.ValidFrom + "<br>");
Response.Write("ValidUntil = " + cs.ValidUntil + "<br>");
Response.Write("What's this = " + cs.ToString() + "<br>");

.NET Framework
Available since 1.1
Return to top
Show: