HttpWebClientProtocol.ClientCertificates 屬性

定義

取得用戶端憑證的集合。

public:
 property System::Security::Cryptography::X509Certificates::X509CertificateCollection ^ ClientCertificates { System::Security::Cryptography::X509Certificates::X509CertificateCollection ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get; }
[<System.ComponentModel.Browsable(false)>]
member this.ClientCertificates : System.Security.Cryptography.X509Certificates.X509CertificateCollection
Public ReadOnly Property ClientCertificates As X509CertificateCollection

屬性值

X509CertificateCollection,表示用戶端憑證。

屬性

範例

下列程式碼範例示範如何從檔案載入用戶端憑證,然後將它新增至 屬性, ClientCertificates 以呼叫使用用戶端憑證進行驗證的 XML Web 服務方法。

// Create a new instance of a proxy class for the Bank XML Web service.
BankSession bank = new BankSession();

// Load the client certificate from a file.
X509Certificate x509 = X509Certificate.CreateFromCertFile(@"c:\user.cer");

// Add the client certificate to the ClientCertificates property of the proxy class.
bank.ClientCertificates.Add(x509);

// Communicate with the Deposit XML Web service method,
// which requires authentication using client certificates.
bank.Deposit(500);
' Create a new instance of a proxy class for the Bank XML Web service.
Dim bank As BankSession = new BankSession()

' Load the client certificate from a file.
Dim x509 As X509Certificate = X509Certificate.CreateFromCertFile("c:\user.cer")

' Add the client certificate to the ClientCertificates property of the proxy class.
bank.ClientCertificates.Add(x509)

' Communicate with the Deposit XML Web service method,
' which requires authentication using client certificates.
bank.Deposit(500)

備註

此屬性可讓用戶端在呼叫 XML Web 服務方法時傳遞一或多個用戶端憑證,也稱為 Authenticode X.509 v.3 憑證。 如果 XML Web 服務方法已設定為使用用戶端憑證,則可以使用用戶端憑證做為驗證用戶端的一種機制。 如需設定用戶端憑證的詳細資訊,請參閱 Internet Information Services (IIS) 檔。

適用於

另請參閱