Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public ActionResult smsapi()
{

BindDatalist();
string xml = "";
if(Request.InputStream != null)
{
StreamReader stream = new StreamReader(Request.InputStream);
string x = stream.ReadToEnd();
xml = HttpUtility.UrlDecode(x);
}

return View();
}

private void BindDatalist()
{

var url = "http://localhost:56833/Home/smsapi";
var postData = "<xml>.....</xml>";
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(postData);

var req = (HttpWebRequest)WebRequest.Create(url);

req.ContentType = "text/xml";
req.Method = "POST";
req.ContentLength = bytes.Length;

using (Stream os = req.GetRequestStream())
{
os.Write(bytes, 0, bytes.Length);
}

string response = "";
req.Timeout = 60000;
// req.KeepAlive = true;
using (System.Net.WebResponse resp = req.GetResponse())
{
using (StreamReader sr = new StreamReader(resp.GetResponseStream()))
{
response = sr.ReadToEnd().Trim();
}
}
}

Exeption : "The request was aborted: The operation has timed out."
Posted
Updated 28-Jul-15 21:09pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900