开发者

How are multiple ServicePointManager.ServerCertificateValidationCallback methods evaluated?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜