开发者

jQuery ajax auto update without affecting session timeout

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 deman开发者_开发知识库d. 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


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)

<script type="text/javascript">
var sessionTimeout = window.setTimeout(function(){
  window.location.href='/login.asp?reason=Timeout&reqpage=' + encodeURI(window.location.href);
}, 2460000);
</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜