重定向我的页面,然后使用asp.net发送短信 [英] Redirect my page then send sms using asp.net
问题描述
我有这样的URL http://127.0.0.1:81/Redirect.aspx?TagId=1,
因为我正在传递来自数据库的querystring参数值,
基于tad id将显示数据库(URL)中的另一列.
我的问题是我想更改查询字符串参数将打开一个页面(该页面的URL从数据库表中来),然后我将向基于TagId
I have URL like this http://127.0.0.1:81/Redirect.aspx?TagId=1,
In that I am passing querystring parameter value comming from database,
Based on tad id It will display Another column is their in database(URL)
My question is I want to changing query string parameter One page will open(That page url comming from database table)along with that one I will send sms to number based on TagId
推荐答案
的数字发送短信
您的代码从数据库中获取URL.现在,您需要对上面的代码进行一些小的更改,以从数据库中获取电话号码.在其中添加额外的列名称"phonenumber".这是
Your code fetches the URL from the database. Now you need to make a small change in the above code to fetch the phone number from the database. Add the extra column name ''phonenumber'' to it . Here it is
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, phonenumber from redirecturl where Tadid=" + Dno, con);//** FIXED HERE
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
QS2.DataSource = dr;
QS2.DataBind();
dr.Close();
object drReader = cmd.ExecuteScalar();
if (drReader != null)
{
URL = drReader["couponurl"].ToString();//FIXED HERE
phonenumber = drReader["phonenumber "].ToString();//FIXED HERE
}
con.Close();
if (!String.IsNullOrEmpty(URL))
{
//Use Iframe if it works
ifrmBrs.Attributes["src"] =URL;
Session ["phonenumber "]=phonenumber;//FIXED HERE
}
}
然后重定向到Response.Redirect(URL);
然后,在重定向页面的Page_Load上,您可以调用Web服务发送SMS.请记住,不能仅通过asp.net发送SMS.您需要购买SMS服务并将其集成到asp.net应用程序中.
Then redirect to Response.Redirect(URL);
Then on the Page_Load of the redirected page, you can call the webservice to send SMS. Remember that SMS cannot be sent through asp.net alone. You need to buy a SMS service and integrate it into asp.net application
我正在数据库中创建phonenumber列,但出现错误,
I am creating phonenumber column in database getting an error,
URL = drReader["couponurl"].ToString();
phonenumber = drReader["phonenumber "].ToString();
错误:无法将indexind with []应用于类型"object"的表达式
ErrorIs:Can''t apply indexind with[]to an expression of type ''object''
这篇关于重定向我的页面,然后使用asp.net发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!