X509ServiceCertificateAuthentication.CustomCertificateValidator 属性

定义

获取或设置自定义客户端证书验证程序。

public:
 property System::IdentityModel::Selectors::X509CertificateValidator ^ CustomCertificateValidator { System::IdentityModel::Selectors::X509CertificateValidator ^ get(); void set(System::IdentityModel::Selectors::X509CertificateValidator ^ value); };
public System.IdentityModel.Selectors.X509CertificateValidator CustomCertificateValidator { get; set; }
member this.CustomCertificateValidator : System.IdentityModel.Selectors.X509CertificateValidator with get, set
Public Property CustomCertificateValidator As X509CertificateValidator

属性值

X509CertificateValidator

自定义客户端证书验证程序。

例外

试图在凭据为只读时进行设置。

示例

下面的代码演示如何设置此属性。

// Configure custom certificate validation.
ClientCredentials creds = new ClientCredentials();
creds.ServiceCertificate.Authentication.CertificateValidationMode
    = X509CertificateValidationMode.Custom;
creds.ServiceCertificate.Authentication.CustomCertificateValidator
    = new MyCertificateValidator();
' Configure custom certificate validation.
Dim creds As New ClientCredentials()
creds.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.Custom
creds.ServiceCertificate.Authentication.CustomCertificateValidator = New MyCertificateValidator()

该属性也可以在配置文件中设置。

注解

Windows Communication Foundation (WCF) 提供了一个默认的客户端证书验证程序,用于验证客户端证书是否针对受信任的人员存储,并检查证书是否是连接到有效根的链的一部分。 可实现自定义验证程序以获取不同的行为。 此属性允许指定自定义验证程序。

适用于