开发者

How are multiple ServicePointManager.ServerCertificateValidationCallback methods evaluated?

开发者 https://www.devze.com 2023-04-08 18:15 出处:网络
How is the following code evaluated?开发者_运维知识库 ServicePointManager.ServerCertificateValidationCallback += ValidateRemoteCertificateA;

How is the following code evaluated?开发者_运维知识库

ServicePointManager.ServerCertificateValidationCallback += ValidateRemoteCertificateA;
ServicePointManager.ServerCertificateValidationCallback += ValidateRemoteCertificateB;

Given an HttpWebRequest, is it enough if one of the Validator methods returns true, or do they both have to return true? i.e.

ValidateRemoteCertificateA && ValidateRemoteCertificateB

or

ValidateRemoteCertificateA || ValidateRemoteCertificateB

?

Cheers, tamberg


It will use the return value of the last delegate added, in all cases.

ServerCertificateValidationCallback is a multicast delegate property.
Writing ServerCertificateValidationCallback += x appends x to its invocation list.
The return value of a multicast delegate is the return value of the last delegate in its list.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号