在Global.asax.cs文件中的Session_Start事件中处理:
protected void Session_Start(Object sender, EventArgs e)
{
string strFile = this.Context.Request.FilePath.ToString();
string strRoot = Application["RootUrl"].ToString();
if(strFile.Equals("/"+strRoot+"/E.aspx"))
{
this.Response.Redirect("/"+strRoot+"/login.aspx");
}
}
protected void Session_Start(Object sender, EventArgs e)
{
string strFile = this.Context.Request.FilePath.ToString();
string strRoot = Application["RootUrl"].ToString();
if(strFile.Equals("/"+strRoot+"/E.aspx"))
{
this.Response.Redirect("/"+strRoot+"/login.aspx");
}
}
web.config中添加
<authentication mode="Forms">
<forms name=".test" loginUrl="login.aspx" protection="All" timeout="120"/>
</authentication>
其他目录,如果不需要强制转换,则不用以上内容。
我已在
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
DO..........
End Sub中解决了!!!