ASP.NET: Send SMS using MVC using ASPSMS


Sending SMS from mvc application using ASPSMS service is pretty easy.


  • Text SMS, Binary SMS, Unicode SMS etc.
  • Concatenated SMS (up to 9 SMS linked together as one SMS, up to 1377 characters)
  • Bulk SMS functionality
  • Personalized bulk SMS deliveries
  • Define an originator for each sent SMS
  • Realtime SMS delivery notifications
  • Intelligent SMS routing which provides best possible delivery quality
  • ASPTOKEN, innovative two-factor authentication method
  • ASPSMS offers the most extensive SMS roaming (over 200 countries and 900 mobile networks)

Get Free Trial Account:



  • Create trial account signing in to website using Email and Password. You will receive USERKEY and Sender Approved Number 


       public String TestASPSMS(SmsModel obj)
            const string url = "";
            const string action = "";
            XmlDocument soapEnvelopeXml = CreateSoapEnvelopeForASPSMS(obj);
            HttpWebRequest webRequest = CreateWebRequest(url, action);
            InsertSoapEnvelopeIntoWebRequest(soapEnvelopeXml, webRequest);
            string result;
            using (WebResponse response = webRequest.GetResponse())
                using (StreamReader rd = new StreamReader(response.GetResponseStream()))
                    result = rd.ReadToEnd();
            return result;
        private static HttpWebRequest CreateWebRequest(string url, string action)
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
            webRequest.Headers.Add("SOAPAction", action);
            webRequest.ContentType = "text/xml;charset=\"utf-8\"";
            webRequest.Accept = "text/xml";
            webRequest.Method = "POST";
            return webRequest;
        private static XmlDocument CreateSoapEnvelopeForASPSMS(SmsModel obj)
            obj.Sender = "Sender_Approved_Number";
            XmlDocument soapEnvelopeXml = new XmlDocument();
            soapEnvelopeXml.LoadXml(@"<?xml version=""1.0"" encoding=""utf-8""?>
                    <soap:Envelope xmlns:soap="""" xmlns:xsi="""" xmlns:xsd="""">
                    <SendSimpleTextSMS  xmlns="""">
                    <Recipients>" + obj.Reciever + "</Recipients>" +
                    "<Originator>" + obj.Sender + "</Originator>" +
                    "<MessageText>" + obj.Message + "</MessageText>" +
                    "</SendSimpleTextSMS >" +
                    "</soap:Body>" +
            return soapEnvelopeXml;
        private static void InsertSoapEnvelopeIntoWebRequest(XmlDocument soapEnvelopeXml, HttpWebRequest webRequest)
            using (Stream stream = webRequest.GetRequestStream())



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your 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 )

Google+ photo

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

Connecting to %s