Code Snippets - Sending SMS through ASP.NET

Category > ASP.NET || Published on : Thursday, January 14, 2016 || Views: 7537 || Sending SMS through ASPNET Sending SMS


Here Pawan Kumar will explain how to Send SMS through ASP.NET


In previous post I have explained How to change some text before it is sent to the client in with example, How to sum the value of gridview column using jquery in with example, How to compress response in with example, How to display progress indicator during ajax call in using jQuery, How to rotating image with ASP.NET 4.0 and C# with example, How to turn off submit button when it pressed in ASP.Net, and many more articles.

Now I will explain How to Code Snippets - Sending SMS through ASP.NET

So follow the steps to learn Code Snippets - Sending SMS through ASP.NET

Today I am describing you simplest way to send SMS using ASP.NET and API from SMS providers.

Whenever you will get SMS's from providers they will also provide you

  1. userid
  2. password
  3. senderid

They will provide you API to integrate with your website to send sms.

The SMS Service Provider will also provide you a 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.

You can use the below method to Send SMS :-

protected void btnSendMessage_Click(object sender, EventArgs e)
        string senderusername = "xxxxx";
        string senderpassword = "xxxx";
        string senderid = "xxx";       
        string sURL;
        StreamReader objReader;
        sURL = "" + senderusername + "&password=" + senderpassword + "&sender=" + senderid + "&mobile=91" + txtMobileNumber.Text + "&type=1&message=" + txtMessage.Text;
        WebRequest wrGETURL;
        wrGETURL = WebRequest.Create(sURL);
            Stream objStream;
            objStream = wrGETURL.GetResponse().GetResponseStream();
            objReader = new StreamReader(objStream);
        catch (Exception ex)

Please note the that in above code you have to change the websitename with your SMS Service provide URL

Hope you have enjoyed this small but useful code. Happy Coding!!!!!!



So, In this tutorial we have learned, Code Snippets - Sending SMS through ASP.NET