由于连续的ajax调用,会话无效不起作用

发布于 2024-10-10 00:20:44 字数 207 浏览 0 评论 0原文

我的应用程序每 3 分钟向服务器发送一次简单的 ajax http 请求。

而且由于 ajax 请求更新 httpd 会话信息,会话超时不起作用,即使

我设置了 30 分钟的默认会话超时。

有什么方法可以避免使用连续的ajax请求更新httpd会话超时信息?

我希望 http 会话在 30 分钟后失效,无论连续的 ajax 请求如何。

My application sends simple ajax http request to server every 3 minutes.

And because ajax request update httpd session info, session timeout is not working, even

though I set 30 minute default session timeout.

Is there any way to keep away from updating httpd session timeout info with continuous ajax request ?

I want http session invalidate after 30 minutes, regardless of continuous ajax request.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

帝王念 2024-10-17 00:20:44

您可以创建一个以时间戳作为值的会话变量。

每次用户请求页面时,您都可以更新时间戳。

除非是 Ajax 请求。

每次发生 Ajax 请求时,您都可以检查是否已过去 30 分钟,如果已过去,则销毁会话。

这是我能想到的唯一方法。

You can create a session variable with a timestamp as value.

Everytime a user request a page you can update the timestamp.

Except when it is the Ajax request.

Everytime the Ajax request takes place you can check whether 30 mins have gone by and if so destroying the session.

That´s the only way I can think of.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文