how to send sms in asp.net using c#
public void SendSms()
{
try
{
string username = "";
string password = "";
string sender = "test";
string domian = "";
string Heading1 = "Welcome To your website";
string Heading2 = string.Concat("Dear ", txtName.Text, ",", "Your Confirmation Is:", txtcode.Text);
string end = "Enter this code in the registration form. Thanking You";
string Msg = string.Concat(Heading1, ",", Heading2, ",", end);
string pn = txtMobile.Text;
string result = apicall("http://" + domian + "/WebserviceSMS.aspx?username=" + username + "&password=" + password + "&sender=" + sender + "&to=" + pn + "&message=" + Msg);
}
catch
{
}
}
public string apicall(string url)
{
HttpWebRequest httpreq = (HttpWebRequest)WebRequest.Create(url);
try
{
HttpWebResponse httpres = (HttpWebResponse)httpreq.GetResponse();
StreamReader sr = new StreamReader(httpres.GetResponseStream());
string results = sr.ReadToEnd();
sr.Close();
return results;
}
catch
{
return "0";
}
}
public void SendSms()
{
try
{
string username = "";
string password = "";
string sender = "test";
string domian = "";
string Heading1 = "Welcome To your website";
string Heading2 = string.Concat("Dear ", txtName.Text, ",", "Your Confirmation Is:", txtcode.Text);
string end = "Enter this code in the registration form. Thanking You";
string Msg = string.Concat(Heading1, ",", Heading2, ",", end);
string pn = txtMobile.Text;
string result = apicall("http://" + domian + "/WebserviceSMS.aspx?username=" + username + "&password=" + password + "&sender=" + sender + "&to=" + pn + "&message=" + Msg);
}
catch
{
}
}
public string apicall(string url)
{
HttpWebRequest httpreq = (HttpWebRequest)WebRequest.Create(url);
try
{
HttpWebResponse httpres = (HttpWebResponse)httpreq.GetResponse();
StreamReader sr = new StreamReader(httpres.GetResponseStream());
string results = sr.ReadToEnd();
sr.Close();
return results;
}
catch
{
return "0";
}
}
No comments:
Post a Comment