1

当 asp.net 应用程序中的会话超时时,我们需要关闭用户已经打开的所有网页。

每个页面都有退出链接。当用户单击该链接时,主页将被重定向到该页面。

在这种情况下,其他打开的页面也需要关闭。

我们应该怎么做?

4

3 回答 3

1

对于所有页面:

  1. AJAX 回调服务器检查 Session 是否过期。
  2. 解析 AJAX 的结果
  3. 如果会话结束,则关闭窗口或重定向到注销页面。
于 2009-12-18T07:45:40.430 回答
0

On the second thought... we can use what @thephpdeveloper said, particularly when user signs out formally... (like clicking the signout button) Once After a formal Sign out happens... Such Ajax Call back can be used, cause the session will be valid but there will not be any user... Using this we can signal the page and close the browser window

于 2009-12-18T08:05:00.797 回答
0

正如 Razzie 评论的那样,对同一个 Web 应用程序执行 AJAX 回调将使会话保持活动状态。使用网络服务也不能解决问题。

此解决方案避免保持会话活动:

  • 将每个会话存储在数据库中。这可以在登录Session_StartGlobal.asax或登录后完成。
  • Session_End在文件中的事件中Global.asax或注销后从数据库中删除超时会话。
  • 对不同的 Web 应用程序(例如在子域上运行的 Web)执行定期 AJAX 回调,以检查数据库是否仍然存在会话。

我建议您使用 SessionID 来识别会话。

于 2009-12-18T14:02:06.817 回答