有没有办法手动增加/减少特定 aspx 页面的超时?
Kevin Pang
问问题
10099 次
3 回答
8
在 web.config 中:
<configuration>
<location path="~/Default.aspx">
<system.web>
<httpRuntime executionTimeout="1000"/>
</system.web>
</location>
</configuration>
于 2008-10-21T21:20:21.700 回答
2
要记住的一件事是这里的超时功能只会使会话超时无效,但用户仍将留在他们所在的任何页面上。这可能会导致应用程序流程出现问题。作为补救措施,我在 Web.config 文件中保留以下内容:
<appSettings>
<!-- Application Timeout is 10 minutes -->
<add key="SessionTimeoutMilliseconds" value="600000"/>
</appSettings>
此外,我的母版页在我的代码隐藏文件中有以下代码:
' Register Javascript timeout event to redirect to the login page after inactivity
Page.ClientScript.RegisterStartupScript(Me.GetType, "TimeoutScript", _
"setTimeout(""top.location.href = '/EAF/Login.aspx'""," & _
ConfigurationManager.AppSettings("SessionTimeoutMilliseconds") & ");", True)
你应该在两端都做好准备。
于 2008-10-21T21:29:05.770 回答
0
如果您正在谈论页面返回超时之前所花费的时间,那么 mnour 的示例 - 您可能还想查看 machine.config 文件。如果您谈论会话超时,那么您将需要使用 JS 计时器,该计时器在达到 0 时回发。
于 2008-10-21T21:23:05.393 回答