我正在尝试使用 HttpWebRequest
获取页面,但出现以下异常:
Could not establish trust relationship for the SSL/TLS secure channel.
是否可以为 HttpWebRequest
的特定实例指定自定义 RemoteCertificateValidationCallback
?
(我不能使用 ServicePointManager.ServerCertificateValidationCallback
,因为我的代码是库的一部分。)
最佳答案
I cannot use ServicePointManager.ServerCertificateValidationCallback, since my code is part of a library
这样做,但根据发件人过滤对委托(delegate)的调用?
更新:根据反馈:可能需要启动一个 AppDomain 来执行此操作(这将避免干扰同一进程中发生的其他事情)。
关于c# - 如何在 HTTPS 中处理自定义证书?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3424671/