Redigeeri

Jagamisviis:


ServicePointManager.ServerCertificateValidationCallback Property

Definition

Gets or sets the callback to validate a server certificate.

public:
 static property System::Net::Security::RemoteCertificateValidationCallback ^ ServerCertificateValidationCallback { System::Net::Security::RemoteCertificateValidationCallback ^ get(); void set(System::Net::Security::RemoteCertificateValidationCallback ^ value); };
public static System.Net.Security.RemoteCertificateValidationCallback? ServerCertificateValidationCallback { get; set; }
public static System.Net.Security.RemoteCertificateValidationCallback ServerCertificateValidationCallback { get; set; }
static member ServerCertificateValidationCallback : System.Net.Security.RemoteCertificateValidationCallback with get, set
Public Shared Property ServerCertificateValidationCallback As RemoteCertificateValidationCallback

Property Value

A RemoteCertificateValidationCallback. The default value is null.

Remarks

An application can set the ServerCertificateValidationCallback property to a method to use for custom validation by the client of the server certificate. When doing custom validation, the sender parameter passed to the RemoteCertificateValidationCallback can be a host string name or an object derived from WebRequest (HttpWebRequest, for example) depending on the CertificatePolicy property.

When custom validation is not used, the certificate name is compared with the host name used to create the request. For example, if Create(String) was passed a parameter of "https://www.contoso.com/default.html", the default behavior is for the client to check the certificate against www.contoso.com.

Despite being a multicast delegate, only the value returned from the last-executed event handler is considered authoritative. In other words, you can attach multiple delegates, and they all get a callback from ServerCertificateValidationCallback. Each callback returns a value that indicates whether the certificate is accepted or not; however, only the value from the last delegate is respected.

Applies to

See also