X509ClientCertificateAuthentication.CustomCertificateValidator Property


Gets or sets a custom client certificate validator.

Namespace:   System.ServiceModel.Security
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public X509CertificateValidator CustomCertificateValidator { get; set; }

Property Value

Type: System.IdentityModel.Selectors.X509CertificateValidator

The custom client certificate validator.

Exception Condition

set when credential is read-only.

If the CertificateValidationMode property is set to Custom, you must set the CustomCertificateValidator property to a custom validator that inherits from the X509CertificateValidator class.

For more information, seeHow to: Create a Service that Employs a Custom Certificate Validator.

The following code shows how to set this property.

// Create a service host.
Uri httpUri = new Uri("http://localhost/Calculator");
ServiceHost sh = new ServiceHost(typeof(Calculator), httpUri);

// Get a reference to the authentication object.
X509ClientCertificateAuthentication myAuthProperties =

// Configure custom certificate validation.
myAuthProperties.CertificateValidationMode =
// Specify a custom certificate validator (not shown here) that inherits 
// from the X509CertificateValidator class.
// creds.ClientCertificate.Authentication.CustomCertificateValidator =
//    new MyCertificateValidator();

The property can also be set in a configuration file.

     <authentication certificateValidationMode='Custom' customCertificateValidatorType='Samples.MyCertificateValidator, Samples' />

.NET Framework
Available since 3.0
Return to top