Error sending sms using your way2sms account in asp.net

Posted by sourabhghosh49-13964 under ASP.NET on 3/12/2012 | Points: 10 | Views : 8247 | Status : [Member] | Replies : 8
this is my code---
using System.Text.RegularExpressions;

public partial class send : System.Web.UI.Page
{
string mbno, mseg, ckuser, ckpass;
private HttpWebRequest req;
private CookieContainer cookieCntr;
private string strNewValue;
public static string responseee;
private HttpWebResponse response;

protected void Page_Load(object sender, EventArgs e)
{
//if (Session["id"] == null && Session["pw"] == null)
//{
// Server.Transfer("login.aspx");
//}
connect();

if (!(IsPostBack))
{
btnSend.Attributes.Add("onclick", "return Validate('" + txtTo.ClientID + "','" + txtMessage.ClientID + "');");
txtMessage.Attributes.Add("onchange", "TextChange('" + txtMessage.ClientID + "','" + lblLeft.ClientID + "');");
txtMessage.Attributes.Add("onkeyup", "TextChange('" + txtMessage.ClientID + "','" + lblLeft.ClientID + "');");
}


}
protected void btnSend_Click(object sender, EventArgs e)
{
try
{
mbno = txtTo.Text;
mseg = txtMessage.Text;

sendSms(mbno, mseg);
txtTo.Text = "";
txtMessage.Text = "";
}
catch (Exception ex)
{
lblError.Text = ex.Message;
lblError.Visible = true;
}
}
public void connect()
{
ckuser = Session["id"].ToString();
ckpass = Session["pw"].ToString();

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 = "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();-->>here gives that error
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";

}



it is giving an error like--

The remote server returned an error: (404) Not Found

in line 86

sourabh


Responses

Posted by: Hmanjarawala on: 3/12/2012 [Member] Bronze | Points: 25

Up
0
Down
plz check your requested url ("http://wwwd.way2sms.com//jsp/InstantSMS.jsp?val=0"). is it working?

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: sourabhghosh49-13964 on: 3/12/2012 [Member] Starter | Points: 25

Up
0
Down
ya...i can't send sms through this direct link....
what should i do......

sourabh

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: sourabhghosh49-13964 on: 3/12/2012 [Member] Starter | Points: 25

Up
0
Down
hey.....plz tell me how to solve that error.....

sourabh

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 3/12/2012 [Member] Bronze | Points: 25

Up
0
Down
Way2Sms is messaging portal, and you can use its services after buying sufficient message quota...
have you purchase membership from there?

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: sourabhghosh49-13964 on: 3/12/2012 [Member] Starter | Points: 25

Up
0
Down
no.i do'nt have any membership but
i do'nt think so.
because i am just want to use the simple sms sending instead of sms gateway.
and this facility provide way2sms fully free of cost.
there are no need of any type of subscription.

sourabh

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: sourabhghosh49-13964 on: 3/12/2012 [Member] Starter | Points: 25

Up
0
Down
This is 404 error.
and i think this error is for unavailability of pages.
i think server could not find that page.

sourabh

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 3/12/2012 [Member] Bronze | Points: 25

Up
0
Down
As per my knowledge.....
to integrate Way2Sms service with your software you need membership..
that is only reason of this error.....

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: sourabhghosh49-13964 on: 3/12/2012 [Member] Starter | Points: 25

Up
0
Down
may be possible....
thanks for instant reply..

sourabh

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response