// Create a 'WebRequest' object with the specified url.
string url = "..."; // The url with a querystring
HttpWebRequest myWebRequest = (HttpWebRequest)WebRequest.Create(url);
X509Certificate Cert = X509Certificate.CreateFromCertFile("userCert.cer");
myWebRequest.Method = "POST";
myWebRequest.ClientCertificates.Add(Cert);
// Send the 'WebRequest' and wait for response.
WebResponse myWebResponse = myWebRequest.GetResponse();
The GetResponse throws an exception with the message, "The underlying
connection was closed: Could not establish trust relationship for the SSL/TLS
secure channel."
The certificate is good because I can connect interactively, but with some
certificate issues. The certificate is self-signed without a root authority.
How can I get this work?
As always, thanks,
Eagle