共用方式為


HttpWebRequest.ClientCertificates 屬性

定義

取得或設定與此要求相關聯的安全性憑證集合。

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,其中包含與此要求相關聯的安全性憑證。

例外狀況

設定工作指定的值 null

備註

謹慎

WebRequestHttpWebRequestServicePointWebClient 已經過時,您不應該將它們用於新的開發。 請改用 HttpClient

應用程式可以將憑證新增至集合,但可能沒有其訪問許可權。 若要使用集合中包含的憑證,應用程式必須具有與核發憑證之實體相同的訪問許可權。

注意

架構會在建立 SSL 工作階段時快取 SSL 工作階段,並盡可能嘗試重複使用新要求的快取會話。 嘗試重複使用 SSL 會話時,Framework 會使用 ClientCertificates 的第一個專案(如果有的話),或在 ClientCertificates 空白時嘗試重複使用匿名會話。

注意

基於效能考慮,除非您知道伺服器會要求客戶端憑證,否則您不應該將客戶端憑證新增至 HttpWebRequest

如需說明如何在用戶端證書存儲中列舉憑證的程式代碼範例,請參閱 X509Certificate2Collection 類別。

適用於