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;
}
Loading
Iftikar HussainPosted Aug 16, 2013, 3:08 AM
Please refer the below link
http://stackoverflow.com/questions/703272/could-not-establish-trust-relationship-for-ssl-tls-secure-channel-soap
http://forums.asp.net/t/1862524.aspx/1?the+underlying+connection+was+closed+could+not+establish+trust+relationship+for+the+SSL+TLS+secure+channel+
Regards,
Iftikar