the underlying connection was closed. could not establish trust relationship for the ssl/tls secure

Posted by Prabu_Spark under ASP.NET on 8/16/2013 | Points: 10 | Views : 2358 | Status : [Member] | Replies : 1
Hi sir,
I am getting the below error, while hosting the website in webserver.


"the underlying connection was closed. could not establish trust relationship for the ssl/tls secure channel".
I attached the code for your refernce. Kindly give me the solution for this problem.


public string posted_data()
{
string urls="http://www.mydomain.com?uname=hi&password=123";
ASCIIEncoding encoding = new ASCIIEncoding();
Stream newStream;
string postData = "";
postData += (urls);


byte[] data = encoding.GetBytes(urls);

// Prepare web request...
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(urls);

myRequest.Method = "POST";
myRequest.Accept = "text/plain";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
newStream = myRequest.GetRequestStream();
// Send the data.

newStream.Write(data, 0, data.Length);
// grab the response
HttpWebResponse HttpWResp = (HttpWebResponse)myRequest.GetResponse();
Stream streamResponse = HttpWResp.GetResponseStream();

// And read it out
StreamReader reader = new StreamReader(streamResponse);
string response = reader.ReadToEnd();
newStream.Close();
return response;
}

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

Posted by: Bandi on: 8/16/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
refer this link
http://asheeriyam.blogspot.in/2013/04/could-not-establish-trust-relationship.html
http://stackoverflow.com/questions/703272/could-not-establish-trust-relationship-for-ssl-tls-secure-channel-soap

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response