session timeout prompt asp.net

Posted by renathy on Stack Overflow See other posts from Stack Overflow or by renathy
Published on 2012-12-13T10:49:05Z Indexed on 2012/12/13 11:04 UTC
Read the original article Hit count: 167

Filed under:
|

The application I am using is implementing some session timeout prompt using jquery. There is a timer that counts and if there is no user activity after predefined X minutes it shows user prompt

(Your session will end soon... Continue or Logout).

It uses the approach found here - http://www.codeproject.com/Articles/227382/Alert-Session-Time-out-in-ASP-Net.

However, this doesn't work if user opens new tab:

1) User logs in, timer starts counting user inactivity's.

2) User clicks some link that opens in new window (for example, in our case it is a long report running). Second tab is active, there is some response (crossbacks / postbacks that doesn't end session).

3) Second browser tab is active, there is some activity that doesn't end session.

4) However, first browser tab is inactive and counter is "thinking" that session should be closed, it displays appropriate message and then logout user.

This is not what we want. So the given approach is just some session timeout fix, but if user is active in another tab, then application will logout user anyway. That is not the desired thing. We have a Report Page. It functions so that it opens report in a new tab/window. And it could be run quite long. Report section take care of some callbacks, so session wont end in this tab. However, it would end in the second tab.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about timeout