Waterforelef
New Member
Recently I was trying to learn how to send sms using ways2sms gateway.After I had successfully entered my UserName (ie my mobilenumber) & Password required for the authentication of sending sms through my mobile no.Following error prompted: Error connecting to the Server.What may be the problem:I am facing Error at: Line\[code\]{ this.response = (HttpWebResponse)this.req.GetResponse(); }try { this.req = (HttpWebRequest)WebRequest.Create("http://wwwd.way2sms.com/auth.cl"); this.req.CookieContainer = new CookieContainer(); this.req.AllowAutoRedirect = false; this.req.Method = "POST"; this.req.ContentType = "application/x-www-form-urlencoded"; this.strNewValue = "http://stackoverflow.com/questions/15586678/username=" + ckuser + "&password=" + ckpass; this.req.ContentLength = this.strNewValue.Length; StreamWriter writer = new StreamWriter(this.req.GetRequestStream(), Encoding.ASCII); writer.Write(this.strNewValue); writer.Close(); this.response = (HttpWebResponse)this.req.GetResponse(); this.cookieCntr = this.req.CookieContainer; this.response.Close(); this.req = (HttpWebRequest)WebRequest.Create("http://wwwd.way2sms.com//jsp/InstantSMS.jsp?val=0"); this.req.CookieContainer = this.cookieCntr; this.req.Method = "GET"; this.response = (HttpWebResponse)this.req.GetResponse(); responseee = new StreamReader(this.response.GetResponseStream()).ReadToEnd(); int index = Regex.Match(responseee, "custf").Index; responseee = responseee.Substring(index, 0x12); responseee = responseee.Replace("\"", "").Replace(">", "").Trim(); this.response.Close(); pnlsend.Visible = true; lblErrormsg.Text = "connected"; } catch (Exception) { lblErrormsg.Text = "Error connecting to the server..."; Session["error"] = "Error connecting to the server..."; Server.Transfer("login.aspx"); }\[/code\]