Thursday, February 16

Send Sms Using Way to sms Dll

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>

Code Behind:-

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);
    }
}

Thanks Shibashish mohanty

23 comments:

  1. spider : it's work very fine...and very fast

    ReplyDelete
    Replies
    1. Please help me it is not working 30venadesh@gmail.com please help me.

      Delete
  2. hi firend its working

    ReplyDelete
  3. Thanks dear to view my page

    ReplyDelete
  4. its not working for me

    ReplyDelete
    Replies
    1. Its working Now I forgot to add reference Thanks Dude

      Delete
    2. what is that add reference thing

      Delete
    3. which refernce we need to add? its not working for me too..

      Delete
    4. reference ?? Qhich one? plz help my program runs but not send any msg. plz help...

      Delete
  5. what is the use of following code ?????

    HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
    System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
    string responseString = respStreamReader.ReadToEnd();

    ReplyDelete
    Replies
    1. responsestring ra kama kan mu bujhi paruni thik se....so plz help me out,

      Delete
  6. We are requesting something thats why

    ReplyDelete
    Replies
    1. but what is the advantage putting thar responsereader into string;
      seithi tike doubt rahijauchhi.....what if we dont write string responseString = respStreamReader.ReadToEnd();

      Delete
  7. We have to read/check that userid and password which is not set in your local database it is fetched from way to sms database.Thats the reason.i thinks that was your doubt.Thanks for your valuable comment. Further any doubt Feel free to call me.

    ReplyDelete
  8. hi shibashish i used ur code but it does not work error shows in httpresponse....

    ReplyDelete
    Replies
    1. try this one
      http://shibashishdotnetocean.blogspot.in/2012/01/send-sms-to-mobile-in-aspnet-using.html

      Delete
  9. Hi Shibashish I used your code its not working, the code which in return is coming is -11.

    Kindly please let me know whats wrong

    ReplyDelete
  10. Hi Shibashish... I have used your code but does not working and not even giving any error. Connection Length is giving as -1.

    Can you please suggest any solution.

    ReplyDelete
  11. This is my latest post please go for it,its working fine
    http://shibashishdotnetocean.blogspot.in/2013/04/send-free-sms-using-aspnet-source-code.html

    ReplyDelete
  12. 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

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

.

ShibashishMnty
shibashish mohanty