"The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."

  • Thread starter Thread starter Thejovathi
  • Start date Start date
T

Thejovathi

Guest
I am able to send HTTP Post request using Google Chrome - PostMan client.

But with below code:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Timeout = 1200000;
byte[] bytes;
bytes = System.Text.Encoding.ASCII.GetBytes(jsonText);
request.ContentType = "application/json";
request.ContentLength = bytes.Length;
request.Method = "POST";
request.ClientCertificates.Add(cert);
Stream requestStream = request.GetRequestStream();
requestStream.Write(bytes, 0, bytes.Length);
requestStream.Close();
response = (HttpWebResponse)request.GetResponse();
I am getting error as:

Message = "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."

What additional header do I need to include?

Continue reading...
 
Back
Top