Wednesday, January 4

Send Sms To mobile in Asp.net Using way2sms

hello
     This is my page view

This is my source code:
               <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Shibashish mohanty</title>
    <style type="text/css">
        .style1
        {
            width: 34%;
            height: 99px;
        }
        .style2
        {
            width: 133px;
        }
        .style3
        {
            width: 35px;
        }
        .style4
        {
            width: 26px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div align="center" >
   
        <table class="style1"
            style="background-position: center center; border: thick solid #C0C0C0;"
            bgcolor="#336600">
            <tr>
                <td class="style4" style="color: #FFFFFF">
                    To:</td>
                <td class="style2">
                   <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
                <td class="style3">
                    &nbsp;</td>
                <td style="color: #FFFFFF">
                    Msg:</td>
                <td>
                   <asp:TextBox ID="TextBox2" TextMode="MultiLine" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td class="style4">
                    &nbsp;</td>
                <td class="style2">
                    &nbsp;</td>
                <td class="style3">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style4">
                    &nbsp;</td>
                <td class="style2">
                    &nbsp;</td>
                <td class="style3">
                    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Send" />
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style4">
                    &nbsp;</td>
                <td class="style2">
                    &nbsp;</td>
                <td class="style3">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
        <br />
        <table class="style1"
           
           
           
            style="background-position: center center; border: thick solid #990000; position: fixed; border-collapse: collapse; display: block; background-color: #333300; top: 188px; left: 461px;">
            <tr>
                <td class="style4" style="color: #FFFFFF">
                    UserID:</td>
                <td class="style2">
                   <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></td>
                <td class="style3">
                    &nbsp;</td>
                <td style="color: #FFFFFF">
                    Password:</td>
                <td>
                   <asp:TextBox ID="TextBox4" TextMode="Password" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td class="style4">
                    &nbsp;</td>
                <td class="style2">
                    &nbsp;</td>
                <td class="style3">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style4">
                    &nbsp;</td>
                <td class="style2">
                    &nbsp;</td>
                <td class="style3">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style4">
                    &nbsp;</td>
                <td class="style2">
                    &nbsp;</td>
                <td class="style3">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
   
    </div>
    </form>
</body>
</html>


This is my code behind .cs:


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(TextBox3.Text,TextBox4.Text, TextBox2.Text, TextBox1.Text);
    }
}

This is my browser view:


In browser you are looking two different color Blocks ,in below block you have to pass your way2sms user id and password.if not available please go to www.way2sms.com and register there first.
Thanks shibashish mohanty



37 comments:

  1. My source code

    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(TextBox3.Text,TextBox4.Text, TextBox2.Text, TextBox1.Text);
    }
    }

    ReplyDelete
    Replies
    1. superb..then i need the code of http://ubaid.tk/sms/sms.aspx..plz send to my emailid santhosh.net@live.in

      Delete
    2. hello..
      i m also trying to do the same..but unable to do..code is running but msg is not any mob no.help!! i also need the code of http://ubaid.tk/sms/sms.aspx..plz mail at sakshibhatnagar0929@gmail.com..
      thanks in advance
      plz help as soon as possible.

      Delete
    3. When we use above code then response value return -11 what is the problem

      please help!

      Delete
    4. I got this error. please help me.The remote server returned an error: (503) Server Unavailable.

      Delete
    5. hi,
      the code is running but msg is not delivered to any mob no.plz give me the code of http://ubaid.tk/sms/sms.aspx..plz mail at sharaditmca@gmail.com.plz help as soon as possible.
      thanks in advance

      Delete
  2. thanx Shibashish.....!!!
    this got help me a lot....!
    :)

    ReplyDelete
  3. thanx Shibashish.....!!!
    this got help me a lot....!
    :)

    http://shivrampopalghat.blogspot.in/

    ReplyDelete
  4. Awesome yar its working great and also help me a lot ...
    Thanx :)

    ReplyDelete
    Replies
    1. for me not working.. bcoz i send sms daily.. y fri.. pl reply me

      Delete
  5. Thanks. Shibashish..........Your Code help me a lot..........

    ReplyDelete
  6. didnt work fri.. i send daily message throw asp.net page.. help me.

    ReplyDelete
  7. hey fri i send bulk sms in asp.net page throw database how can i send fri...

    ReplyDelete
  8. Hey it didn't work for me...I have account in way2sms also..Plzz help me

    ReplyDelete
  9. Hello respected ,

    due to changes in Way2Sms web sites the Followings Code does not Working Please try to show another way...

    Thanks in advance..

    ReplyDelete
  10. this code is not working.........PLease upload any other option

    Thank you

    ReplyDelete
  11. i have posted the latest one please go for it,its working fine http://shibashishdotnetocean.blogspot.in/2013/04/send-free-sms-using-aspnet-source-code.html

    ReplyDelete
  12. ("http://ubaid.tk/sms/sms.aspx?uid=" + uid + "&pwd=" + password +
    "&msg=" + message + "&phone=" + no + "&provider=way2sms");


    i can't understand this part.

    ReplyDelete
    Replies
    1. reply fast Shibashish Mohanty...

      Delete
    2. That one is web service and you do not need to understand what it is?Now way2sms is not working.you just use fullonsms at the place of way2sms.Thanks

      Delete
  13. hi its a nice.i want to source code of this project and my mail id is sathya.qlx@gmail.com

    ReplyDelete
  14. Hi, PLease mail be this source code on atul.bitspilani@gmail.com

    ReplyDelete
  15. not working........

    ReplyDelete
  16. it is not working for me

    ReplyDelete
  17. please go to this link
    http://www.shibashishdotnetocean.com/2013/04/send-free-sms-using-aspnet-source-code.html#.UeE3C231J4M

    ReplyDelete
  18. It shows that mesg sent but not getting mesg.

    ReplyDelete
  19. msg was not went to any mobile and also i am not getting any error....plz help me plz send the solution to saikumarneelams@gmail.com

    ReplyDelete
  20. it's not working........

    ReplyDelete
  21. am getting the exception ...
    The remote server returned an error: (503) Server Unavailable.

    ReplyDelete
  22. I get error
    "The remote server returned an error: (503) Server Unavailable"

    ReplyDelete
  23. i am using ur code,this is not working..pls help me...HTTP Error 503 - Service unavailable

    ReplyDelete

Please don't spam, spam comments is not allowed here.

.

ShibashishMnty
shibashish mohanty