Hello Guys in this post i will tell you that how you can send the sms using the Asp.net with C#. For this process there is the need of sms server which are generally very costly but in this vast internet there are also some free stuffs. That's why i have chosen the free sms serever Way2sms. So you just need the free way2sms account.
Now here is the C# code of the process.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void send(string uid, string password, string message, string no)
{
HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create("http://ubaid.tk/sms/sms.aspx?uid=" +
uid + "&pwd=" + password +
"&msg=" + message + "&phone=" + no + "&provider=way2sms");
HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
System.IO.StreamReader respStreamReader = new System.IO.StreamReader
(myResp.GetResponseStream());
string responseString = respStreamReader.ReadToEnd();
respStreamReader.Close();
myResp.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
send("Your_Way2sms_Mobino","Your_Password", TextBox2.Text, TextBox1.Text);
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void send(string uid, string password, string message, string no)
{
HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create("http://ubaid.tk/sms/sms.aspx?uid=" +
uid + "&pwd=" + password +
"&msg=" + message + "&phone=" + no + "&provider=way2sms");
HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
System.IO.StreamReader respStreamReader = new System.IO.StreamReader
(myResp.GetResponseStream());
string responseString = respStreamReader.ReadToEnd();
respStreamReader.Close();
myResp.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
send("Your_Way2sms_Mobino","Your_Password", TextBox2.Text, TextBox1.Text);
}
}
Download Working Code...... DOWNLOAD HERE
i tried your code but i am getting error as
ReplyDeleteThe remote server returned an error: (503) Server Unavailable.
please help...