Why wouldn't I be able to establish a trust relationship for a SSL/TLS channel?
Posted
by
Abe Miessler
on Stack Overflow
See other posts from Stack Overflow
or by Abe Miessler
Published on 2010-12-30T22:08:20Z
Indexed on
2010/12/31
18:54 UTC
Read the original article
Hit count: 242
I have a piece of .NET code that is erroring out when it makes a call to HTTPWebRequest.GetRequestStream
. Here is the error message:
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
I've read a few things that suggest that I might need a certificate on the machine running the code, but i'm not sure if that's true or how to do it.
If I need to get a certificate, how do I do it?
Code:
var request = (HttpWebRequest)HttpWebRequest.Create(requestUrl); //my url
request.Method = StringUtilities.ConvertToString(httpMethod); // Set the http method GET, POST, etc.
if (postData != null)
{
request.ContentLength = postData.Length;
request.ContentType = contentType;
using (var dataStream = request.GetRequestStream())
{
dataStream.Write(postData, 0, postData.Length);
}
}
© Stack Overflow or respective owner