ASP.NET - Send SMS from Web Application - Asked By mostafa hamdy on 01-Jul-12 07:32 AM

Hello all
I have some web application build in 4.0 C# ,and I want my application to send SMS message to mobiles , how can I do that , please any body get what I mean and can help me please send me or tell me about some URL may help me to do that
Lalit M replied to mostafa hamdy on 01-Jul-12 08:28 AM
->First you need Purchas from Value-First SMS Provider to send SMS.
->using XML API to send SMS from in web application
->develop the GUI for sending SMS.

code sample of ASPX
    <%@Page Language=”C#”AutoEventWireup=”true”CodeBehind=”SMS.aspx.cs”Inherits=”SMSTest.SMS” %>

    <!DOCTYPE htmlPUBLIC“-//W3C//DTD XHTML 1.0 Transitional//EN”“”>

    <html xmlns=””>

    <head runat=”server”>



    <body style=”height: 313px”>

    <form id=”form1″runat=”server”>


    <h1> Sending SMS Application </h1>











    <asp:LabelID=”lblBody”runat=”server”Text=”SMS Message:-”></asp:Label>



    <asp:TextBoxID=”txtBody”  TextMode=”MultiLine”runat=”server”></asp:TextBox>




    <asp:Label ID=”lblResult”runat=”server”Text=” “></asp:Label>





Code sample of CS
    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Web;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    using System.Web.UI.WebControls.WebParts;

    using System.Web.UI.HtmlControls;

    using System.IO;

    using System.Net;

    using System.Text;

    namespace SMSTest


    public partial class SMS : System.Web.UI.Page


    protected void Page_Load(object sender, EventArgs e)



    protected void btnSend_Click(object sender, EventArgs e)


    System.Net.WebClient webClient = new System.Net.WebClient();

    string postData = “usr=yourapiusername&pwd=yourapipwd&from= “ + txtFrom.Text + “&to=” + txtTo.Text +“&type=text” + txtBody.Text;


    lblResult.Text = webClient.UploadString(“<?xml%20version=\”1.0\”%20encoding=\”ISO-8859-1\”?><!DOCTYPE%20MESSAGE%20SYSTEM%20\”\”%20><MESSAGE><USER%20USERNAME=\”Your SMS API Username” + “\”%20PASSWORD=\”Your SMS API Password” + “\”/><SMS%20UDH=\”0\”%20CODING=\”1\”%20TEXT=\”" + txtBody.Text + “\”%20PROPERTY=\”0\”%20ID=\”1\”><ADDRESS%20FROM=\”919903013543\”%20TO=\”" + txtTo.Text + “\”%20SEQ=\”1\”%20TAG=\”some%20clientside%20random%20data\”%20/></SMS></MESSAGE>&action=send”, postData);



Also good article here: <>
Jitendra Faye replied to mostafa hamdy on 02-Jul-12 01:10 AM
Using Ozeki NG-SMS gateway you can send sms using c# code-

follow this link-

try this code-

protected void buttonSendOnClick(object sender, EventArgs e)
      //Create the request and send data to Ozeki NG SMS Gateway Server by
      HTTP connection
      HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(createdURL);

      //Get response from Ozeki NG SMS Gateway Server and read the answer
      HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
      System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
      string responseString = respStreamReader.ReadToEnd();

      //inform the user
      textboxError.Text = responseString;
      textboxError.Visible = true;
    catch (Exception)
      //if sending request or getting response is not successful, Ozeki NG - SMS Gateway Server may not be running
      textboxError.Text = "Ozeki NG SMS Gateway Server is not running!";
      textboxError.Visible = true;

dipa ahuja replied to mostafa hamdy on 02-Jul-12 04:16 AM
The StrikeIron Global SMS Pro Web Service enables an SMS (text) message to be sent to virtually any mobile phone instantly. This service supports over 416 carriers in 160 countries. In addition, the success of message delivery is tracked and reported using the Web service. see what carriers and countries are supported.