Error when using client certificate over SSL
Hi,
I am trying to connect to a web service using a client certificate over SSL. I get a "The underlying connection was closed. Could not establish a secure SSL/TLS connection" exception.
ServicePointManager.CertificatePolicy = new MyCertPolicyClass();
wreq.ClientCertificates.Add
(X509Certificate.CreateFromCertFile("c:\\myx509.ce r"));
wreq.Method = "POST";
string poststring = requestXML;
wreq.ContentLength = poststring.Length;
wreq.ContentType = "text/xml";
StreamWriter sw = new StreamWriter(wreq.GetRequestStream());
I get an error when I am trying to obtain the request stream in order to send the request XML.
I am able to do a GET from a browser using the certificate successfully. So, I know the certificate is valid and trusted by the web server.
I am also able to read the properties of the certificate from the code.
Any pointers would go a long way!
Thanks in advance,
Subra
|