保持会话存活的最佳方法是什么?

发布于 2024-10-11 05:48:12 字数 131 浏览 0 评论 0原文

我们使用让我保持登录记住我选项登录到应用程序,那么实现此功能的最佳方式是什么?

我们是否必须在浏览器中保留 cookie 才能实现这些目的? 在应用中实现这一目标的最佳方法是什么

We use keep me logged in or Remember me option to be logged in to application so to do that which is best way to achieve this feature?

Whether we have to keep cookie in browser for these or what?
Which is the best way to achieve this in application

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

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

发布评论

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

评论(2

澜川若宁 2024-10-18 05:48:12

这将取决于服务器端如何处理会话。如果它使用滑动过期,您可以在每个页面上包含一些 javascript,它将定期向服务器发送虚拟 AJAX 请求以保持会话处于活动状态。如果你想在浏览器关闭的情况下保持会话,那么你需要使用 persistent cookie 存储在用户计算机上,而不是仅 HTTP 的 cookie。

This will depend on how is the session handled on the server side. If it uses sliding expiration you could include some javascript on each page which will send a dummy AJAX request to the server at regular intervals to keep the session alive. If you want to keep the session even if the browser is closed then you need to use persistent cookies which are stored on the user computer rather than HTTP only cookies.

小草泠泠 2024-10-18 05:48:12

最好的方法是在浏览器中保存cookie,但要加密。

我用的就是这个方法,挺好的

The best way is to keep cookie in browser,but encrypted.

I use this way.It's good.

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