HttpRequest.ClientCertificate HttpRequest.ClientCertificate HttpRequest.ClientCertificate HttpRequest.ClientCertificate Property

定义

获取当前请求的客户端安全证书。Gets the current request's client security certificate.

public:
 property System::Web::HttpClientCertificate ^ ClientCertificate { System::Web::HttpClientCertificate ^ get(); };
public System.Web.HttpClientCertificate ClientCertificate { get; }
member this.ClientCertificate : System.Web.HttpClientCertificate
Public ReadOnly Property ClientCertificate As HttpClientCertificate

属性值

包含有关客户端安全证书设置的信息的 HttpClientCertificate 对象。An HttpClientCertificate object containing information about the client's security certificate settings.

示例

下面的代码示例在 HTML 页中将客户端的证书设置发送回客户端。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>");
   
   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>")
   

适用于