---
title: "When ever a redirect page automatically send sms World wide using asp.net?"  
description: "When ever a redirect page automatically send sms World wide using asp.net?"  
author: "anil babu"  
published: 2012-10-09  
updated: 2012-10-14  
canonical: https://www.mindstick.com/forum/456/when-ever-a-redirect-page-automatically-send-sms-world-wide-using-asp-dot-net  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 3 minutes  

---

# When ever a redirect page automatically send sms World wide using asp.net?

I have URL like this http://127.0.0.1:81/[Redirect](https://www.mindstick.com/forum/2005/radio-button-redirect).aspx?TagId=1,In that I am passing [querystring](https://www.mindstick.com/interview/123/what-is-querystring-benefits-and-limitations-of-using-querystring) [parameter](https://www.mindstick.com/blog/450/parameter-class-in-c-sharp) value comming from database,Based on tad id It will display Another column is their in database(URL)\
My [question](https://www.mindstick.com/blog/23175/how-to-solve-neet-question-paper-in-less-time) is I want to changing [query string](https://www.mindstick.com/articles/512/query-string-in-asp-dot-net) parameter [One page](https://www.mindstick.com/forum/118/problem-in-display-content-of-one-page-to-another-page) will open(That page url comming from [database table](https://www.mindstick.com/forum/159366/how-to-test-regular-expressions-in-sql-without-using-database-table))along with that one I will send sms to number based on TagId\
MYProgram:

```
Page1.aspx
<asp:GridView ID="QS1" runat="server" AutoGenerateSelectButton="True" AutoGenerateColumns="false"
        onselectedindexchanging="GvDept_SelectedIndexChanging">

.cs
protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(@"Data Source=<>;Initial Catalog=productdb;Persist Security Info=True;User ID=<>;Password=<>");

        SqlDataAdapter da = new SqlDataAdapter("select * from redirecturl", con);

        DataSet ds = new DataSet();
        da.Fill(ds, "redirecturl");
        QS1.DataSource = ds.Tables["redirecturl"];
        QS1.DataBind();
        QS1.DataKeyNames = new string[] { "Tagid" };
    }
    protected void GvDept_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        QS1.SelectedIndex = e.NewSelectedIndex;

        string Dno = QS1.SelectedValue.ToString();
        Response.Redirect("~/Page2.Aspx?TagId="+Dno);

    }
Page2.aspx
<div>
    <asp:GridView ID="QS2" runat="server"
        EmptyDataText="There Are No Employees In Selected Department"
            AutoGenerateColumns="false" Width="99px">

        <br />

        <iframe width="100%"  runat="server" id="ifrmBrs">your browser does not support IFRAMEs</iframe>

    </div>
.cs
String URL = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        string Dno = Request.QueryString["TagId"];

        SqlConnection con = new SqlConnection(@"Data Source=<>;Initial Catalog=productdb;Persist Security Info=True;User ID=<>;Password=<>");



        SqlCommand cmd = new SqlCommand("select coupounurl from redirecturl where Tadid=" + Dno, con);

        con.Open();

        SqlDataReader dr = cmd.ExecuteReader();
        QS2.DataSource = dr;
        QS2.DataBind();
        dr.Close();

        object drReader = cmd.ExecuteScalar();
        if (drReader != null)
        {
            URL = drReader.ToString();
        }

        con.Close();
        if (!String.IsNullOrEmpty(URL))
        {
            //Use Iframe if it works
            ifrmBrs.Attributes["src"] =URL;
}
}
```

I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) this oneMy QUESTION IS tABLE Tagid coupounurl phonenumber 1 http://page4.aspx 655666666 2 http://page5.aspx 67867668 3 http://page6.aspx 6868769879 Based on tag id Redirect perticular url, In redirect perticular url based on TagId I want to send sms to perticular pnonenumber([Worldwide](https://answers.mindstick.com/qa/99997/what-is-worldwide-developers-conference-held-by-apple)) I dont known idea on sending sms plz help me ........

## Replies

### Reply by anil babu

No,First It's working fin After that I am Purchasing to service,Present I am Trying this code,

```
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();          StreamReader respStreamReader = new StreamReader(myResp.GetResponseStream());          string responseString = respStreamReader.ReadToEnd();          respStreamReader.Close();          myResp.Close();         }protected void Button1_Click(object sender, EventArgs e)        {                       send("<PhoneNumber>","anil", TextBox2.Text, TextBox1.Text);        }
```

### Reply by John Smith

Have you purchased any third party service to send SMS ?


---

Original Source: https://www.mindstick.com/forum/456/when-ever-a-redirect-page-automatically-send-sms-world-wide-using-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
