In this article we will see an example of sending SMS from our winforms C#.Net or VB.Net desktop Application using HTTP API  and tracking the status of SMS .

Below is the screen shot of Application
In this example i have used the HTTP API of .
In order to send SMS, you should have an account with the Service Provider. The HTTP API differs for different service providers.
When you buy SMS credits, you will get UserName and Password, which you have to replace in  HTTP API provided by respective service provider.
The concept here is, we have to send HTTP request from our code. It can be done in many ways.  The same code you can also use in your Asp.Net Application. You can download the Application full Source Code from the link provided below.

The C# Code to send SMS is like this

         /// <summary>
        /// Function send Http request and returns the status of the message
        /// </summary>
        /// <param name=”strMsg”>Message to be sent</param>
        /// <param name=”MobNo”>MobileNumber</param>
        /// <returns></returns>
        private string SendSMS(string strMsg, stringMobNo)
            string SmsStatusMsg = string.Empty;
                //Sending SMS To User
                WebClient client = new WebClient();
                string URL = “” + strMsg + “&PhoneNumber=” + MobNo + “&track=1”;
                SmsStatusMsg = client.DownloadString(URL);
                if (SmsStatusMsg.Contains(“<br>”))
                    SmsStatusMsg = SmsStatusMsg.Replace(“<br>”, “, “);
            catch (WebExceptione1)
                SmsStatusMsg = e1.Message;
            catch (Exceptione2)
                SmsStatusMsg = e2.Message;
            return SmsStatusMsg;


The VB.Net Code for sending SMS is :

    ”’ <summary>
    ”’ Function send Http request and returns the status of the message
    ”’ </summary>
    ”’ <param name=”strMsg”>Message to be sent</param>
    ”’ <param name=”MobNo”>mobile Number</param>
    ”’ <returns></returns>
    ”’ <remarks></remarks>
    Private Function SendSMS(ByVal strMsg AsString, ByValMobNo As String) As String
        Dim SmsStatusMsg As String = String.Empty
            ‘Sending SMS To User
            Dim client As WebClient = New WebClient()
            Dim URL As String = “” & strMsg & “&PhoneNumber=”& MobNo &”&track=1”
            SmsStatusMsg = client.DownloadString(URL)
            If SmsStatusMsg.Contains(“<br>”) Then
                SmsStatusMsg = SmsStatusMsg.Replace(“<br>”, “, “)
            End If
        Catch e1 As WebException
            SmsStatusMsg = e1.Message
        Catch e2 As Exception
            SmsStatusMsg = e2.Message
        End Try
        Return SmsStatusMsg
    End Function

3 thoughts on “Sending SMS using HTTP API in C#.Net / VB.Net Winforms Application”

  1. my name is Zain from Indonesia, i wanna ask u, what the use application version ? Iam using Visual Basic.NET 2008. its thats not work. cant to open file. and while I click the button Send Sms notification "no recipient for message", I fill in the textbox with full, please your explanation , thanks before

  2. Dear Zain, the source code available for download is for VS2010, u cannot open this in VS2008. copy the code and create a new project in VS2008, and debug the program. And you should have sms credits with the service provider with valid username and password. May i know what is ur SMS API ?

Comments are closed.