X509Certificate2(certpath)-不支持给定的路径格式

问题描述 投票:2回答:1

当我通过httpwebrequest发送SSL证书时,出现错误-不支持给定的路径格式。这是代码。

string cerpath = @"c:\sagar\cert.cer";
string url = @"C:\localhost\";

Httpwebrequest req = (Httpwebrequest)WebRequest.Create(url);

X509Cetificate2 cert = new X509Certificate2(cerPath);

//Raises error The given paths format is not supported

req.ClientCertificate.Add(cert);
c# ssl-certificate x509certificate
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.