How to send SMS in asp.net

Ranjeet_8
Posted by Ranjeet_8 under ASP.NET category on | Points: 40 | Views : 2279

public void SendSingle(string phonenumber, string message)
{
string appsettingSendSmsKey = "http://www.YourProviderDomain.com/Sendsms.aspx?|Username|password|sendfrom|cdmaHeader"; // Provided by Your Vender
string[] sendsmskey = appsettingSendSmsKey.Split('|');
string URL = sendsmskey[0];
string usernam = sendsmskey[1];
string password = sendsmskey[2];
string sendfrom = sendsmskey[3];
string CdmaHeader = sendsmskey[4];
StringBuilder sburl = new StringBuilder();
sburl.Append(URL);
sburl.Append("UserName=");
sburl.Append(usernam);
sburl.Append("&password=");
sburl.Append(password);
sburl.Append("&SenderID=");
sburl.Append(sendfrom);
sburl.Append("&MobileNo=");
sburl.Append(phonenumber);
sburl.Append("&CDMAHeader=");
sburl.Append(CdmaHeader);
sburl.Append("&Message=");
sburl.Append(message);
WebRequest request = default(WebRequest);
request = WebRequest.Create(sburl.ToString());
request.Method = WebRequestMethods.Http.Get;
WebResponse respnse = default(WebResponse);
respnse = request.GetResponse();
StreamReader sr = new StreamReader(respnse.GetResponseStream());
string str = sr.ReadToEnd();
sr.Close();
respnse.Close();
}

Comments or Responses

Login to post response