Gui*_*sta 2 .net routes asp.net-mvc-3
有没有办法让我通过使用内部规则localhost/subscribe将每个访问权限重定向到或者我应该从操作重定向?localhost/subscribe.aspxglobal.asax.cs
以下代码应该适合您:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (Request.RawUrl.ToLower().EndsWith("subscribe"))
{
Response.Redirect("subscribe.aspx");
}
}
Run Code Online (Sandbox Code Playgroud)
或者在Application_PreRequestHandlerExecute方法内部,如果您还要使用Session进行验证
| 归档时间: |
|
| 查看次数: |
11217 次 |
| 最近记录: |