Export (0) Print
Expand All

X509ClientCertificateAuthentication.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

One of the X509CertificateValidationMode values.

The following example uses the CertificateValidationMode to print to the screen.

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

// Create a binding that uses a certificate.
WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
b.Security.Message.ClientCredentialType =
    MessageCredentialType.Certificate;

// Get a reference to the authentication object.
X509ClientCertificateAuthentication myAuthProperties =
    sh.Credentials.ClientCertificate.Authentication;

switch (myAuthProperties.CertificateValidationMode)
{
    case X509CertificateValidationMode.ChainTrust:
        Console.WriteLine("ChainTrust");
        break;
    case X509CertificateValidationMode.Custom:
        Console.WriteLine("Custom");
        break;
    case X509CertificateValidationMode.None:
        Console.WriteLine("ChainTrust");
        break;
    case X509CertificateValidationMode.PeerOrChainTrust:
        Console.WriteLine("PeerOrChainTrust");
        break;
    case X509CertificateValidationMode.PeerTrust:
        Console.WriteLine("PeerTrust");
        break;
    default:
        Console.WriteLine("Default");
        break;
}

The property can also be set in a configuration file.

<serviceCredentials>
  <clientCertificate>
     <authentication certificateValidationMode='ChainTrust' />
  </clientCertificate>
</serviceCredentials>

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