Export (0) Print
Expand All

X509ServiceCertificateAuthentication.CertificateValidationMode Property

Gets the certificate validation mode.

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

public X509CertificateValidationMode CertificateValidationMode { get; set; }
/** @property */
public X509CertificateValidationMode get_CertificateValidationMode ()

/** @property */
public void set_CertificateValidationMode (X509CertificateValidationMode value)

public function get CertificateValidationMode () : X509CertificateValidationMode

public function set CertificateValidationMode (value : X509CertificateValidationMode)

Not applicable.

Property Value

A value from the enumeration in X509CertificateValidationMode.

This enumeration captures the options for determining the validity of the service certificate obtained using SSL/TLS negotiation. For a list of the enumeration members, see X509CertificateValidationMode.

The following code shows how to set this property.

ClientCredentials creds = new ClientCredentials();
// Configure peer trust.
creds.ServiceCertificate.Authentication.CertificateValidationMode =
          X509CertificateValidationMode.PeerTrust;

// Configure chain trust.
creds.ServiceCertificate.Authentication.CertificateValidationMode =
              X509CertificateValidationMode.ChainTrust;

// Configure custom certificate validation.
creds.ServiceCertificate.Authentication.CertificateValidationMode =
              X509CertificateValidationMode.Custom;
creds.ServiceCertificate.Authentication.CustomCertificateValidator =
    new MyCertificateValidator();

The property can also be set in a configuration file.

    <behaviors>
      <endpointBehaviors>
        <behavior name="behave">
          <clientCredentials>
            <serviceCertificate>
              <authentication certificateValidationMode='ChainTrust' />
            </serviceCertificate>
          </clientCredentials>
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft