我希望在会话超时时自动重定向到登录页面.
在web.config文件中,我有以下代码
<configuration>
<system.web>
<sessionState mode="InProc" timeout="1"/>
</system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)
在Global.asax文件中 -
protected void Session_End(object sender, EventArgs e)
{
Response.Redirect("LoginPage.aspx");
}
Run Code Online (Sandbox Code Playgroud)
但超时后,我收到以下错误:
HttpException未被用户代码处理.
在这种情况下无法获得响应.
有什么线索可以解决这个问题吗?