Sending SMS from ASP.NET C# 4.0 application to Mobile using XML API

Sending & Receiving SMS from ASP.NET application is nowadays integrate parts of enterprise web application specially in the domains of Healthcare, Hospitality, Insurance , Banking sectors where 24X7  available approach with customers are mandatory.

  • In those respect , I have used a code in C# ASP.NET 4.0 using XML API (Purchased from Value-First SMS Provider) to send SMS from our web application to our clients randomly.
  • So, first develop the GUI for sending SMS. So the following code in .aspx:

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

<!DOCTYPE htmlPUBLIC“-//W3C//DTD XHTML 1.0 Transitional//EN””&gt;

<html xmlns=””&gt;

<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>





  • Now , check in Code-behind.

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);




  • Next , Check the output for sending SMS in runtime.

  • Check the Fiddler output for SMS XML API & it’s Status message delivered or not.


  • Status shows the SMS has been delivered so check in handset the received SMS from your ASP.NET Web Application.

About Anindita
Anindita Basak is working as Big Data Cloud Consultant in Microsoft. Worked in multiple MNCs as Developer & Senior Developer on Microsoft Azure, Data Platform, IoT & BI , Data Visualization, Data warehousing & ETL & of course in Hadoop platform.She played both as FTE & v- employee in Azure platform teams of Microsoft.Passionate about .NET , Java, Python & Data Science. She is also an active Big Data & Cloud Trainer & would love share her experience in IT Training Industry. She is an author, forum contributor, blogger & technical reviewer of various books on Big Data Hadoop, HDInsight, IoT & Data Science, SQL Server PDW & PowerBI.

15 Responses to Sending SMS from ASP.NET C# 4.0 application to Mobile using XML API

  1. Pingback: Sending SMS from ASP.NET C# 4.0 application to Mobile using …

  2. Pingback: Buy Facebook Fans

  3. Pingback: My Homepage

  4. Pingback: galaxy note

  5. Pingback: maori

  6. Pingback: Wie viel bezahlt Pflegeversicherung Treppenlift

  7. Pingback: Reviews on Gaming Keyboard

  8. Pingback: James

  9. Pingback: social media training

  10. Pingback: Wellness-Blog Rückenschmerzen

  11. Hi Anindhitha,
    This example is easy to work on. i have some doubts like
    from which website you purchased this SMS gateway and
    can you please upload demo project folder so that it would be usefull for the users

    Santosh Kakani

  12. Pingback: [RESOLVED]Reg: SMS Application using ASP.NET with C# coding | ASP Questions & Answers

  13. Pingback: [RESOLVED]Reg: SMS Application using ASP.NET with C# coding | ASP Web Form Data Control

  14. Pingback: [RESOLVED]Message Sending from a website | ASP Questions & Answers

  15. Pingback: [RESOLVED]Reg: SMS Application using ASP.NET with C# coding | ASP.NET MVC

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: