How to change the following code to using x509 certs in a cert store the local machine?

  • Thread starter Thread starter jens Jensen
  • Start date Start date
J

jens Jensen

HttpWebRequest req =
(HttpWebRequest)HttpWebRequest.Create(ConfigurationManager.AppSettings["URI"]);

req.Proxy = new
System.Net.WebProxy(ConfigurationManager.AppSettings["ProxyString"], true);

req.ContentType = "application/x-www-form-urlencoded";

req.Method = "POST";

byte[] bytes = System.Text.Encoding.ASCII.GetBytes(param);

req.ContentLength = bytes.Length;

System.Net.WebResponse resp = req.GetResponse();

if (req == null) return null;

System.IO.StreamReader sr = new
System.IO.StreamReader(resp.GetResponseStream());

return sr.ReadToEnd().Trim();





I need to secure the communication with ssl. How can this be done?

I have the certs in the local store?



Many thanks in advance

JJ
 
Back
Top