jQuery ajax 自动更新而不影响会话超时
我正在构建一个类似 igoogle 的仪表板。该仪表板的目的是向用户显示不同的关键绩效指标。所有数据均通过 jQuery ajax 调用检索。问题是这些指标必须定期更新,这会影响会话超时变量,因此用户永远不会因为空闲而注销,这是一个重要的规范需求。检查鼠标移动是一种解决方案(如果在一段时间内没有任何鼠标移动,请停止更新),但我想知道是否有其他更灵活的解决方案来解决此问题,也许可以进行一些配置在 IIS 或 Web 服务中制作?
仪表板是使用asp.net/c#和IIS开发的。
祝你今天过得愉快! /尼克拉斯
I'm building an igoogle-like dashboard. The purpose of this dashboard is to show the user different key performance indicators. All data is retrieved by a jQuery ajax call. The problem is that these indicators must be updated periodically and this affects the session timeout variable, hence the user never can be logged out due to idleness which is an important specification demand. Checking for mouse movements is one solution (if there hasn't been any mousemovements for a certain period of time, stop the update) but I'm wondering if there is some other, more agile solution to this problem, perhaps some configuration can be made in IIS or the webservice?
The dashboard is developed with asp.net/c# and IIS.
Have a nice day!
/Niklas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的事情是在主仪表板页面上放置一些 Javascript,它将在指定时间段后重定向用户。如果他们刷新仪表板,仪表板将被重置,但您可能希望如此,但当您的 Ajax 内容自行刷新时,仪表板不会改变。
我自己的应用程序中的一些代码(用会话长度中的毫秒数替换 2460000)
The most straightforward thing would be to just have some Javascript on your main dashboard page that will redirect the user after a specified time period. If they refresh the dashboard that will be reset, but you probably want that, but it wont change when your Ajax stuff refreshes itself.
Some code from my own app (repleace 2460000 with the number of ms in your session length)