Mik*_*ike 2 c# asp.net query-string
我有一个ASP.NET应用程序.在某些页面上,它需要使用页面调用特定的查询字符串,因此可以处理数据.
检查URL中是否包含所需查询字符串的最合适位置在哪里,否则重定向到其他位置?
我只使用了一个主页.
将不胜感激的想法和建议.
谢谢.
我会在每个需要查询字符串项的页面中检查Page_Load函数或更好的Page_Init函数.
protected override void Page_Init (object sender, EventArgs e)
{
if(Request.QueryString["key1"] == "" || Request.QueryString["key1"] == null)
{
Response.Redirect("YOUR_PAGE_HERE");
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2917 次 |
| 最近记录: |