防止 Session.Timeout 延长
如何防止代码隐藏中某些事件的 Session.Timeout
扩展?
<asp:Timer ID="Timer7" runat="server" Interval="540000" ontick="Timer7_Tick">
</asp:Timer>
protected void Timer7_Tick(object sender, EventArgs e)
{
showModalPopupServerOperatorButton_Click(null, null);
Timer7.Enabled = false;
}
最初的计算是,在会话结束前 1 分钟,我将通过 ModalPopup
通知用户一些信息。问题是,当此 Timer7_Tick
事件触发时,Session.Timeout
会更新并且会话会在 10 分钟后结束(如果用户仍然没有从浏览器发送任何请求) 。
How to prevent Session.Timeout
extension on certain event from codebehind?
<asp:Timer ID="Timer7" runat="server" Interval="540000" ontick="Timer7_Tick">
</asp:Timer>
protected void Timer7_Tick(object sender, EventArgs e)
{
showModalPopupServerOperatorButton_Click(null, null);
Timer7.Enabled = false;
}
Initial calculations was that 1 minute before the session ends, i'll inform the user something with the ModalPopup
. The problem is that when this Timer7_Tick
event triggers, the Session.Timeout
renew and the session ends 10 minutes later (if user still don't send any request from his browser).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
服务器端执行将延长会话超时。如果您只想弹出一个对话框,请尝试使用
JavaScript
而无需任何回发。15+ jQuery 弹出模式对话框插件和教程。< /code>
使用
Timer 控件
的替代方法是使用以下 JavaScript:Server side execution will extend session timeout. If you just want to popup a dialog, try using
JavaScript
without any postbacks.15+ jQuery Popup Modal Dialog Plugins and Tutorials.
An alternative of using
Timer control
, use this JavaScript: