Click here to Skip to main content
16,017,954 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void Button1_Click(object sender, EventArgs e)
    {
  
        UriBuilder urlBuilder = new UriBuilder();
        urlBuilder.Host = "127.0.0.1";
        urlBuilder.Port = 8800;

         
        string PhoneNumber = "09638136263";
        string message = "Just a simple text";

        urlBuilder.Query = string.Format("PhoneNumber=%2B" + PhoneNumber + "&Text=" + message);

        HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(new Uri(urlBuilder.ToString(), true));
        HttpWebResponse httpResponse = (HttpWebResponse)(httpReq.GetResponse());

       Response.Write(httpResponse.StatusCode.ToString());
        Response.Write("sms send successfully"); 

}
Posted
Updated 26-Jul-12 1:50am
v3
Comments
bbirajdar 26-Jul-12 7:50am    
"its not working" ?? What does that mean ? Do you have enough balance in your SIM card to send SMS ?
Prasad_Kulkarni 26-Jul-12 7:50am    
..and your questions is??

1 solution

Articles:
Sending SMS using .NET through Web service[^]
Sending SMS text messages using ASP.NET scripts[^]

Discussion links:
sending sms using vb.net[^]
how to send sms through asp.net with c#? [^]

Nutshell: ASP.NET does NOT have any inbuilt API support to send out an SMS. You need to go for a third party solution or use something that is found on the Internet. Articles and discussions above should help you out.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900