次の方法で共有


HttpWebClientProtocol.ClientCertificates プロパティ

クライアント証明書のコレクションを取得します。

Public ReadOnly Property ClientCertificates As _
   X509CertificateCollection
[C#]
public X509CertificateCollection ClientCertificates {get;}
[C++]
public: __property X509CertificateCollection*
   get_ClientCertificates();
[JScript]
public function get ClientCertificates() :
   X509CertificateCollection;

プロパティ値

クライアント証明書を表す X509CertificateCollection

解説

このプロパティにより、クライアントは XML Web サービス メソッドを呼び出したときに Authenticode X.509 v.3 証明書とも呼ばれる 1 つ以上のクライアント証明書を渡すことができます。XML Web サービス メソッドでクライアント証明書を使用するように設定されている場合は、クライアント証明書をクライアント認証の方法の 1 つとして使用できます。クライアント証明書の設定の詳細については、Internet Information Services (IIS) のドキュメントを参照してください。

使用例

[Visual Basic, C#] ファイルからクライアント証明書を読み込んで ClientCertificates プロパティに追加し、認証にクライアント証明書を使用する XML Web サービス メソッドを呼び出すコード例を次に示します。

 
' 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)

[C#] 
// 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);

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

HttpWebClientProtocol クラス | HttpWebClientProtocol メンバ | System.Web.Services.Protocols 名前空間 | ASP.NET を使用して作成した XML Web サービスのセキュリティ | X509CertificateCollection