HttpWebRequest.ClientCertificates 属性

定义

获取或设置与此请求关联的安全证书集合。Gets or sets the collection of security certificates that are associated with this request.

public:
 property System::Security::Cryptography::X509Certificates::X509CertificateCollection ^ ClientCertificates { System::Security::Cryptography::X509Certificates::X509CertificateCollection ^ get(); void set(System::Security::Cryptography::X509Certificates::X509CertificateCollection ^ value); };
public:
 property System::Security::Cryptography::X509Certificates::X509CertificateCollection ^ ClientCertificates { System::Security::Cryptography::X509Certificates::X509CertificateCollection ^ get(); };
public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get; set; }
public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get; }
member this.ClientCertificates : System.Security.Cryptography.X509Certificates.X509CertificateCollection with get, set
member this.ClientCertificates : System.Security.Cryptography.X509Certificates.X509CertificateCollection
Public Property ClientCertificates As X509CertificateCollection
Public ReadOnly Property ClientCertificates As X509CertificateCollection

属性值

X509CertificateCollection,包含与此请求关联的安全证书。The X509CertificateCollection that contains the security certificates associated with this request.

异常

为集运算指定的值为 nullThe value specified for a set operation is null.

注解

应用程序可以将证书添加到集合,但可能不具有对它的访问权限。An application can add a certificate to a collection, but might not have access rights to it. 若要使用集合中包含的证书,应用程序必须具有与颁发证书的实体相同的访问权限。To use a certificate contained in the collection, the application must have the same access rights as the entity that issued the certificate.

备注

框架在创建时将缓存 SSL 会话,并在可能的情况下尝试重复使用缓存会话来执行新请求。The Framework caches SSL sessions as they are created and attempts to reuse a cached session for a new request, if possible. 尝试重复使用 SSL 会话时,框架使用 ClientCertificates 的第一个元素(如果有),或在 ClientCertificates 为空时尝试重用匿名会话。When attempting to reuse an SSL session, the Framework uses the first element of ClientCertificates (if there is one), or tries to reuse an anonymous sessions if ClientCertificates is empty.

备注

出于性能原因,您不应将客户端证书添加到 HttpWebRequest,除非您知道服务器会询问该证书。For performance reasons, you shouldn't add a client certificate to a HttpWebRequest unless you know the server will ask for it.

有关演示如何枚举客户端证书存储区中的证书的代码示例,请参阅 X509Certificate2Collection 类。For a code example illustrating how to enumerate the certificates in the client certificate store, see the X509Certificate2Collection class.

适用于