Modifier

Partager via


ServiceCredentials.ClientCertificate Property

Definition

Gets the current client certificate authentication and provisioning settings for this service.

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

Property Value

An X509CertificateInitiatorServiceCredential instance.

Examples

The following code shows how to access this property and use it to set additional properties.

serviceHost.Credentials.ClientCertificate.Authentication.CertificateValidationMode =
    X509CertificateValidationMode.Custom;
serviceHost.Credentials.ClientCertificate.Authentication.CustomCertificateValidator =
    new MyX509CertificateValidator("CN=Contoso.com");
serviceHost.Credentials.ClientCertificate.Authentication. _
    CertificateValidationMode = X509CertificateValidationMode.Custom
serviceHost.Credentials.ClientCertificate.Authentication. _
   CustomCertificateValidator = New MyX509CertificateValidator("CN=Contoso.com")

Remarks

You can specify a client certificate authentication model using the Authentication property. In the mutual certificate duplex scenario, you can specify an X.509 certificate to use in a response or callback using the Certificate property.

Applies to