Results 1 to 3 of 3

Thread: Asp.net code for sending sms

  1. #1
    MyersGray is offline Senior Member
    Join Date
    Dec 2009
    Posts
    197
    Rep Power
    3

    Default Asp.net code for sending sms

    Hi. I am .net developer. I am developing one mobile application. For that I want code for sending sms. I tried different code but none of them worked out for me. If you know any useful code then let me know that. Thanks in advanced.

  2. #2
    OrtizCooper is offline Banned
    Join Date
    Dec 2009
    Posts
    186
    Rep Power
    0

    Default

    Code:
    Private void Send_Click(object sender, System.EventArgs e)
    {
        try
        {
            SmsTest.net.webservicex.www.SendSMS smsIndia= 
                  new SmsTest.net.webservicex.www.SendSMS();
            SmsTest.com.webservicex.www.SendSMSWorld smsWorld =  
             new SmsTest.com.webservicex.www.SendSMSWorld();
            if(rdoType.SelectedValue == "1")
                smsIndia.SendSMSToIndia(txtMobileNo.Text.Trim(), 
                        txtEmailId.Text.Trim(), txtMessage.Text);
            else 
                smsWorld.sendSMS(txtEmailId.Text.Trim(), 
                        txtCountryCode.Text.Trim(), 
                        txtMobileNo.Text.Trim(), txtMessage.Text);
            lblMessage.Visible = true;
            lblMessage.Text="Message Send Succesfully";
        }
        catch(Exception ex)
        {
            lblMessage.Visible = true;
            lblMessage.Text="Error in Sending message"+ex.ToString();
        }
    }
    
    private void rdoType_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        if(rdoType.SelectedValue =="1")
            txtCountryCode.Enabled = false;
        else
            txtCountryCode.Enabled = false;
    
    }

  3. #3
    CarterWatson is offline Senior Member
    Join Date
    Dec 2009
    Posts
    189
    Rep Power
    3

    Default

    I suggest you to refer following example of code which may solve your problem:

    Code:
    using System; 
    using System.Data; 
    using System.Configuration; 
    using System.Web; 
    using System.Web.Security; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using System.Web.UI.WebControls.WebParts; 
    using System.Web.UI.HtmlControls; 
    using System.Web.Services; 
    using System.Net; 
    using System.IO; 
    using System.Text; 
    
    public partial class _Default : System.Web.UI.Page 
    { 
    protected void Page_Load(object sender, EventArgs e) 
    { 
    SendSMS(); 
    } 
    public void SendSMS() 
    { 
    UriBuilder urlBuilder = new UriBuilder(); 
    urlBuilder.Host = "127.0.0.1"; 
    urlBuilder.Port = 8800; 
    
    //string PhoneNumber = "60123456789"; 
    string PhoneNumber = "919831851076"; 
    string message = "Just a simple text"; 
    
    urlBuilder.Query = string.Format("PhoneNumber=%2B" + PhoneNumber + "&Text=" + message); 
    
    HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(new Uri(urlBuilder.ToString(), false)); 
    HttpWebResponse httpResponse = (HttpWebResponse)(httpReq.GetResponse()); 
    
    Response.Write(httpResponse.StatusCode.ToString()); 
    Response.Write("sms send successfully"); 
    } 
    }

Similar Threads

  1. Problem sending e-mail
    By Dagobert Oskar in forum Web. 2.0
    Replies: 0
    Last Post: 10-16-2010, 07:36 AM
  2. Asp.net code for sending mail
    By OrtizCooper in forum Programming
    Replies: 1
    Last Post: 07-15-2010, 02:43 PM
  3. php code for sending mail with attachment
    By Davisricky in forum Programming
    Replies: 2
    Last Post: 07-13-2010, 02:52 PM
  4. Html code for sending SMS
    By Brownchris in forum General Internet Terms
    Replies: 1
    Last Post: 07-13-2010, 02:47 PM
  5. Sending PDF File in XML
    By Davismoore in forum Software Jargons
    Replies: 0
    Last Post: 01-20-2010, 02:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48