satheesh babu

satheesh babu

  • NA
  • 128
  • 312.6k

getting error The underlying connection was closed: The connection was closed unexpectedly

Feb 23 2009 1:58 AM

Dear All,

Here i am using below code to request a url as web request.

string url="http://xxx.xx.xxx.xx:xxxx/xxxxt/xxxxxxxx.jsp?usr=xxxxxxx&pass=xxxxxxxxx&msisdn=919876451230&msg=Welcome&sid=xxxxx&fl=0&mt=0"

try

{

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

HttpWebResponse resp = (HttpWebResponse)req.GetResponse();

Stream st = resp.GetResponseStream();

StreamReader sr = new StreamReader(st);

string buffer = sr.ReadToEnd();

sr.Close();

st.Close();

}

catch (Exception Ex)

{

Response.Write(Ex.Message);

}

when i run the above code in my button press event its giving below error,

The underlying connection was closed: The connection was closed unexpectedly

Please help me out.

I also spoke with my sms API provider. there is no problem from their side.

 

 

 

 

 


Answers (1)