【发布时间】:2014-12-18 22:34:57
【问题描述】:
是的,我知道 SO 和 google 上有很多类似的问题。是的,我已经阅读了所有内容并尝试了那里所说的一切。是的,任何解决方案都没有帮助我。
我有在 ASP.NET 应用程序上下文中使用的类库。我的类库从第三方 HTTPS 网站下载数据。该网站需要客户证书。我向LOCAL_MACHINE\MY 添加了证书,并在winhttpcertcfg 中授予了对它的访问权限。
我的LogIn 方法在存储中找到该证书。正如我在调试输出中看到的 - 在这个阶段一切都很好。但后来,当我尝试加载页面时,我得到了The request was aborted: Could not create SSL/TLS secure channel. 异常。
我的代码:
client = new XHttpClient();
X509Store store;
X509CertificateCollection certificates;
store = new X509Store(StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
certificates = store.Certificates.Find(
X509FindType.FindByIssuerName,
"Xxxxxxxx Root CA", true);
// everything is fine here, certificates[0] is my certificate
client.ClientCertificates.AddRange(certificates);
store.Close();
有什么想法吗?
【问题讨论】:
标签: c# asp.net ssl ssl-certificate system.net.httpwebrequest