ServicePointManager.ServerCertificateValidationCallback Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기