Send SMS with ASP .net C# Script

ASP.net (C#) SMS messaging is one of the services we offer. Here we'll show you how to use our SMS gateway in ASP.net (C#). Take the SMS ASP.net (C#) script code below to send SMS via Developers’ Central. Simply register for an account, and you will automatically receive 10 FREE SMS credits to try our service.

Code to send SMS in ASP .net C#:

using System

using System
using System.IO
using System.Net
using System.Text
using System.Web

string sUser = “USERNAME”;
string spwd = “PASSWORD”;
string sNumber = Session["Mobile"].ToString();
string sMessage = “Test SMS From Our Company”;
string sSenderID = “WEBSMS”;
string sURL = “http://<%= domainname %>/smsapi/pushsms.aspx?user=” + sUser + “&pwd=” + spwd + “&to=” + sNumber + “&sid=” + sSenderID + “&msg=” + sMessage + “&fl=0?;
string sResponse = GetResponse(sURL);
Response.Write(sResponse);

public static string GetResponse(string sURL)
{
HttpWebRequest request = (HttpWebRequest)WebRequest
.Create(sURL);
request.MaximumAutomaticRedirections = 4;
request.Credentials = CredentialCache.DefaultCredentials;
try
{
HttpWebResponse response = (HttpWebResponse)request
.GetResponse();
Stream receiveStream = response.GetResponseStream(
);
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
string sResponse = readStream.ReadToEnd();
response.Close();
readStream.Close();
return sResponse;
}
catch
{
return “”;
}
}


Please note that some of the above code has been supplied to SMSGATEWAYHUB by clients. As such, accuracy is not guaranteed by SMSGATEWAYHUB.

© Copyright 2008-2021 SMSGATWAYHUB ™ Technologies Resoures Pvt Ltd.   |   DMCA.com Protection Status