Export (0) Print
Expand All

HttpRequest.ClientCertificate Property

Gets the current request's client security certificate.

[Visual Basic]
Public ReadOnly Property ClientCertificate As HttpClientCertificate
[C#]
public HttpClientCertificate ClientCertificate {get;}
[C++]
public: __property HttpClientCertificate* get_ClientCertificate();
[JScript]
public function get ClientCertificate() : HttpClientCertificate;

Property Value

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

Example

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

[Visual Basic] 
Dim cs As HttpClientCertificate = Request.ClientCertificate
 
 Response.Write("<p>Client Certificate settings:</p>")
 Response.Write("Certificate = " & cs.Certificate.ToString() & "<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>")
    

[C#] 
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>");
    

[C++] 
HttpClientCertificate* cs = Request->ClientCertificate;

 Response->Write(S"ClientCertificate Settings:<br>");
 Response->Write(String::Format(S"Certificate = {0}<br>",         cs->Certificate));
 Response->Write(String::Format(S"Cookie = {0}<br>",              cs->Cookie));
 Response->Write(String::Format(S"Flags = {0}<br>",         __box(cs->Flags)));
 Response->Write(String::Format(S"IsPresent = {0}<br>",     __box(cs->IsPresent)));
 Response->Write(String::Format(S"Issuer = {0}<br>",              cs->Issuer));
 Response->Write(String::Format(S"IsValid = {0}<br>",       __box(cs->IsValid)));
 Response->Write(String::Format(S"KeySize = {0}<br>",       __box(cs->KeySize)));
 Response->Write(String::Format(S"SecretKeySize = {0}<br>", __box(cs->SecretKeySize)));
 Response->Write(String::Format(S"SerialNumber = {0}<br>",        cs->SerialNumber));
 Response->Write(String::Format(S"ServerIssuer = {0}<br>",        cs->ServerIssuer));
 Response->Write(String::Format(S"ServerSubject = {0}<br>",       cs->ServerSubject));
 Response->Write(String::Format(S"Subject = {0}<br>",             cs->Subject));
 Response->Write(String::Format(S"ValidFrom = {0}<br>",     __box(cs->ValidFrom)));
 Response->Write(String::Format(S"ValidUntil = {0}<br>",    __box(cs->ValidUntil)));
 Response->Write(String::Format(S"What's this = {0}<br>",         cs));


[JScript] 
var cs : HttpClientCertificate = Request.ClientCertificate

Response.Write("<p>Client Certificate settings:</p>")
Response.Write("Certificate = " + cs.Certificate.ToString() + "<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>")

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpRequest Class | HttpRequest Members | System.Web Namespace

Show:
© 2014 Microsoft