Time to timeout session

随声附和 提交于 2019-12-13 05:28:30

问题


Is there a way to find out how long the session of the user remains valid ( until it times-out)?

I would like to show this time on a page.

I know how to set the timeout, but could not find how to get the current time to time-out.


回答1:


I think you should track the time with plain JavaScript in the browser and reset with every Ajax/WebSocket call.

You cannot track it at the server because to check the time you need to make a request and this will renew the session.




回答2:


There is a getLastAccessedTime() on the session object, that might help.



来源:https://stackoverflow.com/questions/34263039/time-to-timeout-session

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!