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; 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

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 如果有一個) ,架構會使用 (的第一個元素,如果是空的,則會嘗試重複使用匿名會話 ClientCertificatesWhen 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.

適用於