469,361 Members | 2,453 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,361 developers. It's quick & easy.

Session timeout message

Frinavale
9,735 Expert Mod 8TB
I'm toying with the idea of displaying a message a few minutes before the user's session is about to expire.

Every time the user makes a request to the server with their browser the session time is reset.

The user can be active on the site in multiple tabs in the browser.

This means that I can't tell if the user's time is about to expire client-side because the user may have made a request to the server in some other tab which would reset the Session timeout time.

I know this is probably not the best thing to ask but here I go anyway...is there a way to develop a (*wince*) global JavaScript method for all tabs?

I'm looking into using cookies since they are global...but I'm still curious about global JavaScript methods

-Frinny
Apr 28 '10 #1
8 3535
Dormilich
8,652 Expert Mod 8TB
I’m not aware global objects can access multiple windows/tabs, maybe except the new Storage objects. (and something like Mozilla’s XUL).

you could try to set a variable so that it contains a timestamp some minutes just before the session gets invalid and make an AJAX call to the server to check the timeout value, whether the session ends in some minutes (display message) or has been extended (set new request timeout).
Apr 29 '10 #2
Frinavale
9,735 Expert Mod 8TB
See that's the tricky thing Dorm....
If I make an Ajax call to the server the Session will be reset.

That's why I'm thinking cookies are the best way to go for this solution.

Thanks for the info :)
Apr 29 '10 #3
Dormilich
8,652 Expert Mod 8TB
If I make an Ajax call to the server the Session will be reset.
so you reset the session not by a script, but by request? I thought you could just bypass the reset by calling an appropriate script.
Apr 29 '10 #4
Frinavale
9,735 Expert Mod 8TB
Session is reset by request :)
I am not aware of a way to bypass this...at all.
I don't think it's possible in an ASP.NET web application.
Apr 29 '10 #5
Dormilich
8,652 Expert Mod 8TB
is that independend of the domain (e.g. www.example.com vs. nosession.example.com)?
Apr 29 '10 #6
Frinavale
9,735 Expert Mod 8TB
I'm not sure what you're getting at...
Session dependent on the domain.
Apr 29 '10 #7
Dormilich
8,652 Expert Mod 8TB
darn, I was forgetting the SOP.

sometimes it’s a difference (to the server) if you call http://www.example.com/script1 or http://subdomain.example.com/script2.
Apr 29 '10 #8
Frinavale
9,735 Expert Mod 8TB
:) I see what you're getting at now but this is a web application....any request to it uses the same session. If I requested a different web application under the same domain *I think* it would use a different Session. But I still wouldn't be able to check the session in the first web application....
Apr 29 '10 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by Geigho | last post: by
2 posts views Thread by Greg Decos | last post: by
4 posts views Thread by DavidS | last post: by
11 posts views Thread by Vishal | last post: by
5 posts views Thread by Just D. | last post: by
17 posts views Thread by jensen bredal | last post: by
25 posts views Thread by =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post: by
3 posts views Thread by Mufasa | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.