Sending SMS through ASP.NET using SMS sending API from providers.

Hi,

Here i am describing you simplest way to send SMS using ASP.NET and API from SMS sender providers.

Whenever you will get SMS's from providers they will give you userid , password and senderid also they will provide you API to integrate with your website to send sms.

If you have any control panel from providers then you will get API from support or SMS Integration section.

To integrate this API you need to use add System.IO and System.Net namespaces.

Below is the demo code:

   1:  
   2:  
   3: protected void btnSendMessage_Click(object sender, EventArgs e)
   4:     {
   5:         string senderusername = "xxxxx";
   6:         string senderpassword = "xxxx";
   7:         string senderid = "xxx";        
   8:         string sURL;
   9:         StreamReader objReader;
  10:         sURL = "http://thundersms.com/smsapps/pushsms.php?username=" + senderusername + "&password=" + senderpassword + "&sender=" + senderid + "&mobile=91" + txtMobileNumber.Text + "&type=1&message=" + txtMessage.Text;
  11:         WebRequest wrGETURL;
  12:         wrGETURL = WebRequest.Create(sURL);
  13:         try
  14:         {
  15:             Stream objStream;
  16:             objStream = wrGETURL.GetResponse().GetResponseStream();
  17:             objReader = new StreamReader(objStream);
  18:             objReader.Close();
  19:         }
  20:         catch (Exception ex)
  21:         {
  22:             ex.ToString();
  23:         }
  24:     }
  25:  

Note: Please note that your send URL may be different than above. Here i am using thundersms.com API.

Below Demo Code Available for Download.

Demo Code

Published Monday, October 17, 2011 12:09 AM by Rajneesh Verma

Comments

# Sending SMS through ASP.NET using SMS sending API from providers. - Rajneesh Verma's Blog

Pingback from  Sending SMS through ASP.NET using SMS sending API from providers. - Rajneesh Verma's Blog

# re: Sending SMS through ASP.NET using SMS sending API from providers.

Monday, October 17, 2011 10:01 AM by bobby73

Nice post. Thanks. What will happen when the customer replies to this SMS? Will the providers be able to postback/Call Web service to our site?

# re: Sending SMS through ASP.NET using SMS sending API from providers.

Monday, October 17, 2011 2:10 PM by Rajneesh Verma

Sorry postback will not be possible. Its only one way.

# re: Sending SMS through ASP.NET using SMS sending API from providers.

Wednesday, November 02, 2011 4:15 AM by sundarpadma

WebRequest wrGETURL;   error in this code apply in my project5

# re: Sending SMS through ASP.NET using SMS sending API from providers.

Wednesday, November 02, 2011 4:23 AM by sundarpadma

how can i use this in my project

# re: Sending SMS through ASP.NET using SMS sending API from providers.

Wednesday, November 02, 2011 4:50 AM by Rajneesh Verma

Have you included following namespace in your page:

using System.IO;

using System.Net;

# re: Sending SMS through ASP.NET using SMS sending API from providers.

Friday, December 16, 2011 2:44 AM by Dr.Nick S

I used the following post to build an appointment reminder application

www.sendandreceivesms.com/.../How-to-send-SMS-in-VBNet.aspx

it seemed pretty easy, if you want to check it out

# re: Sending SMS through ASP.NET using SMS sending API from providers.

Tuesday, March 13, 2012 1:26 AM by shubh_786

UR COAD IS NOT WORKING.

# re: Sending SMS through ASP.NET using SMS sending API from providers.

Saturday, March 17, 2012 7:44 AM by mehboob_hoo

I had used your code,the only change i did that i had used 92 instead of 91 bcoz i am living in Pakistan.here is the line

sURL = "thundersms.com/.../pushsms.php + senderusername + "&password=" + senderpassword + "&sender=" + senderid + "&mobile=92" + txtMobileNumber.Text + "&type=1&message=" + txtMessage.Text;

the rest is ur code i just type my number in textbox & some test message but still i didn't receive message,please help me in this regards.thanks

Lailla Khan

# re: Sending SMS through ASP.NET using SMS sending API from providers.

Wednesday, April 18, 2012 2:07 AM by Gaurav Bhatia

the code is good but if the your DND service is not activated the message will not delivered.

Leave a Comment

(required) 
(required) 
(optional)
(required)