error 101 in asp.net??
i am using an sms api to send sms to a mobile phone.
here's my asp.net code:
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
string num = "91"+txtno.Text;
string msg = txtmessage.Text;
string url = "http://smslane.com/vendorsms/pushsms.aspx?user=harshilsh&password=may240586&msi sdn=" + num;
url += "&sid=WebSMS&msg=" + msg;
url += "&fl=0";
Uri uri = new Uri(url);
WebRequest request = WebRequest.Create(uri);
WebResponse response = request.GetResponse();
//String ver = response.ResponseUri();
StreamReader reader = new StreamReader(response.GetResponseStream());
string str = reader.ReadLine();
while (str != null)
{
//Response.Write(str);
//str = reader.ReadLine();
history();
lblStatus.Text = "Message Sent";
}
history();
}
private void history()
{
try
{
if (con.State.ToString() == "Closed")
con.Open();
com = new SqlCommand();
com.Connection = con;
com.CommandText = "Insert Into msgtable (msg,userid,mobileno,date) values(@msg,@userid,@mobileno,@date)";
SqlParameter msg1 = new SqlParameter("@msg", SqlDbType.VarChar,50);
msg1.Value = txtmessage.Text;
com.Parameters.Add(msg1);
SqlParameter userid = new SqlParameter("@userid",SqlDbType.VarChar,50);
userid.Value = Session["user"].ToString();
com.Parameters.Add(userid);
SqlParameter mobileno = new SqlParameter("@mobileno",SqlDbType.VarChar,50);
mobileno.Value = txtno.Text;
com.Parameters.Add(mobileno);
SqlParameter dt = new SqlParameter("@date",SqlDbType.VarChar,50);
DateTime dts = DateTime.Now;
dt.Value = dts.ToShortDateString();
com.Parameters.Add(dt);
com.ExecuteReader();
con.Close();
}
catch (Exception ex)
{
lblStatus.Text = ex.Message.ToString() + ex.Source + ex.HelpLink;
}
}
I am getting the following error afterwards:
error 101 net err_connection_reset unknown error
unable to load sms.aspx the site might be temporarly down.
please note that the above mentioned code is written in the codde behind file of sms.aspx file. on button click the it sends an sms to the given mobile number..
It does send the message but lateron i get this error instead of reloading the page..
|