HttpWebClientProtocol.ClientCertificates Egenskap
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar samlingen med klientcertifikat.
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
Egenskapsvärde
En X509CertificateCollection som representerar klientcertifikaten.
- Attribut
Exempel
I följande kodexempel visas hur du läser in ett klientcertifikat från en fil och sedan lägger till ClientCertificates det i egenskapen för att anropa en XML-webbtjänstmetod som använder klientcertifikat för autentisering.
// 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)
Kommentarer
Med den här egenskapen kan en klient skicka ett eller flera klientcertifikat, även kallat Authenticode X.509 v.3-certifikat, när en XML-webbtjänstmetod anropas. Om XML-webbtjänstmetoden har konfigurerats för att använda klientcertifikat kan ett klientcertifikat användas som en mekanism för att autentisera en klient. Mer information om hur du konfigurerar klientcertifikat finns i dokumentationen om Internet Information Services (IIS).