Home   Subscribe   Linkedin
  Archive Contact  

How To Send SMS From ASP Page Using C#

For Sending Mail From Asp Page to Any Mobile No :

Preparation :Make an Account On "www.way2sms.com" with valid mobile number.

Step 1: (.aspx page)

First of all setup an aspx page with two TextBoxes And a button

TextBox1=For Mobile No.

TextBox2=For Text .

Button = For Submission .

 

Step 2: (.aspx.cs page)

make a method like  below

public void send(string uid, string password, string message, string no)

                {

                    HttpWebRequest myReq =

                    (HttpWebRequest)WebRequest.Create(“http://ubaid.tk/sms/sms.aspx?uid=” + uid + “&pwd=” + password +

                    “&msg=” + message + “&phone=” + no + “&provider=way2sms”);

                    HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();

                    System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());

                    string responseString = respStreamReader.ReadToEnd();

                    respStreamReader.Close();

                    myResp.Close();

                }

 

Step 3:(OnButtonClick)

Call the method on click of Submit Button -

         

protected void Button1_Click(object sender, EventArgs e)

            {

                   send(“YOURMOBILENO”,”YOURPASSWORD”, TextBox2.Text, TextBox1.Text);

             }

Step 4: 

        Replace YOURMOBILENO with your username on Way2sms And ”YOURPASSWORD” with your way2sms password.

 

Step 5:

       Test The Service By Enter Mobileno in TextBox1 And Message In TextBox2 and click on button .

 

Note:Unable to send Message On DoNotDisturb (DND) Service  Activated Cell Number.

Posted by: Ashwani

Categories: ASP.NET, C#

Tags: