【发布时间】:2013-12-25 12:45:57
【问题描述】:
我有两个 asp.net 网站(比如 website1 和 website2)。需要根据某些用户操作将用户从一个网站重定向到另一个网站。有没有办法检测传入的请求是否来自 website1 到 website2。 我试图使用来自 website1 的查询字符串发出请求,但 website2 无法识别该查询字符串。
要为这个问题添加更多详细信息: 在网站 1:
protected void Button1_Click ( object sender, EventArgs e )
{
Response.Redirect ( "http://website2.com/Home.aspx?empid=1" );
}
在 website2 home.aspx 中:
protected void page_init ( object sender, EventArgs e )
{
string str=Request.QueryString ["empid"]; // str is coming as 'null'.
}
提前致谢。 赛卡特
【问题讨论】:
-
什么是查询字符串? “不被认可”是什么意思? website2 是否知道要在查询字符串中检查哪些请求参数?等等等等...显示一些代码会有所帮助。
-
这里的情况:在 website1 中,我有 Response.Redirect("website2/a.aspx?empid=1") 我需要从请求中获取 "empid=1"。Request.QueryString 为空。website2知道查询参数。