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) 文档。

适用于

另请参阅