Pages

Saturday 5 April 2014

Free SMS sending through ASP.NET


Here I developed one web application through which you can send free SMS on any mobile number in India.

Note: Messages will not be delivered if receiver mobile number activated with the DND Service

View of a page: To send SMS you have to follow following steps: 1.Create your account on site2sms.com 2.Now using this account credential create one api key which is used in our code. 3.TO generate API key Click Here 4.Also you need to use ASPSnippets.SmsAPI.dll file add this file into your projects references directory. 5.TO get ASPSnippets.SmsAPI.dll file Click Here

Following code is used for design the page using asp.net

Design smssend.aspx
<form id="form1" runat="server">
    <table border="0">
        <tr>
            <td>
                Your Number:
            </td>
            <td>
                <asp:TextBox ID="txtNumber" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" 
                    runat="server" ErrorMessage="Required"
                    ControlToValidate="txtNumber" ForeColor="Red">
</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                Password:
            </td>
            <td>
                <asp:TextBox ID="txtPassword" TextMode="Password"
                 runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" 
                          runat="server" ErrorMessage="Required"
                    ControlToValidate="txtPassword" ForeColor="Red">
</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                Recepient Number:
            </td>
            <td>
                <asp:TextBox ID="txtRecepientNumber" 
                          runat="server" Width="300" 
                    ontextchanged="txtRecepientNumber_TextChanged">
            </asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" 
                   runat="server" ErrorMessage="Required"
                  ControlToValidate="txtRecepientNumber" ForeColor="Red">
              </asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                Message:
            </td>
            <td>
                <asp:TextBox ID="txtMessage" runat="server"
                       TextMode="MultiLine"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" 
                runat="server" ErrorMessage="Required"
                ControlToValidate="txtMessage" ForeColor="Red">
              </asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                <asp:Button ID="btnSend" runat="server" 
                     Text="Send" OnClick="btnSend_Click" />
            </td>
            <td>
            </td>
        </tr>
    </table>
    </form>
smssend.aspx.cs
  protected void btnSend_Click(object sender, EventArgs e)
        {
            string s = txtRecepientNumber.Text;

            SMS.APIType = SMSGateway.Site2SMS;
            SMS.MashapeKey = "";
            SMS.Username = txtNumber.Text.Trim();
            SMS.Password = txtPassword.Text.Trim();
            if (s.Trim().IndexOf(",") == -1)
            {
                //Single SMS
               
                SMS.SendSms(s.Trim(), txtMessage.Text.Trim());
            }
            else
            {
                //Multiple SMS
                List numbers = s.Trim().Split(',').ToList();
                foreach (string number in numbers)
                {
                 SMS.SendSms(number, txtMessage.Text.Trim());
                }
            }
        }

In above code add your api key. And also import the file 1. using System.Net; 2. using ASPSnippets.SmsAPI;

3 comments:

  1. Please Give Your 2 Minutes to Read,

    Facebook earns $7.87 billion dollors per year, We use Facebook for social networking and to connect with our friends. Thus facebook earn revenue because of us but facebook never shares revenue with any facebook user.

    Although we spend our time on facebook, facebook never pays us anything. Wehy should we use facebook further?

    There is new social networking site launched called Tsu, which pays revenue to users means to us. Tsu gives earning opprtunities to us by using social netwok.

    This is very helpful for bloggers too, because bloggers get paid for his/her content.

    Click here to Join Tsu and to Start Earning..!!

    Q- How Can You Earn?

    A- You have to use Tsu as you use facebook, twitter etc.. nothing more than that.. Tsu will give you advertising revenue generated from the ads shown to your friends. Ads are similar as appears on Facebook.

    Click here to Join Tsu and to Start Earning

    Thanks for being the part of people's welfare by approving this comment. Your Approval will surely help most of your readers to earn money. Just Click here to Sign Up for Tsu and to Start Earning

    Tsu Sign up | Tsu Shortcode | Join Tsu | Tsu Invitation | Tsu


    Thanks for approving this comment, you are helping your readears to earn money. Thanks for your participation in social welfare.

    ReplyDelete
  2. Huge amount of code. I had a similar problem with the connect API SMS. Well that service http://www.intistele.com/ quickly solved my problem and as a result - increased sales.

    ReplyDelete
  3. Sending sms through asp.net using api is good option to connect with your traget customers.It is most using application for online business used today.asp.net sms

    ReplyDelete