共用方式為


ClientCredentials.ClientCertificate 屬性

定義

取得您可以用來提供 X.509 憑證的物件,而該憑證將由用戶端用於向服務進行驗證。

public:
 property System::ServiceModel::Security::X509CertificateInitiatorClientCredential ^ ClientCertificate { System::ServiceModel::Security::X509CertificateInitiatorClientCredential ^ get(); };
public System.ServiceModel.Security.X509CertificateInitiatorClientCredential ClientCertificate { get; }
member this.ClientCertificate : System.ServiceModel.Security.X509CertificateInitiatorClientCredential
Public ReadOnly Property ClientCertificate As X509CertificateInitiatorClientCredential

屬性值

表示用戶端憑證的 X509CertificateInitiatorClientCredential

範例

下列程式碼範例會示範如何使用這個屬性來設定 X.509 憑證。

// Create the client with the binding and EndpointAddress.
CalculatorClient calcClient = new CalculatorClient(b, ea);

// Set the client credential value to a valid certificate.
calcClient.ClientCredentials.ClientCertificate.SetCertificate(
    StoreLocation.CurrentUser,
    StoreName.TrustedPeople,
    X509FindType.FindBySubjectName,
    "client.com");
' Create the client with the binding and EndpointAddress.
Dim calcClient As New CalculatorClient(b, ea)

' Set the client credential value to a valid certificate.
calcClient.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.TrustedPeople, X509FindType.FindBySubjectName, "client.com")

備註

您也可以使用用戶端應用程式組態檔中的憑證 > 來設定此值。 <

適用於