Session.Timeout

R

roko111

I would like to show the user that the Session has timed out. I know I
have to use some kind of timer in Session_OnEnd that will refresh the
page at the end. I'm just not sure how to implement the code. Could
anyone help?
 
A

Alvin Bruney - ASP.NET MVP

When the session has timed out, the session has already ended. You can't
show a message to a user because there is no session. You can, however, show
the message before the time out event occurs since there is a valid session.

--
Warm Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley 2006
Blog: http://msmvps.com/blogs/Alvin/
 
J

Juan T. Llibre

If the session has timed out, the user isn't there anymore.
You can't tell the user that the session has timed out.
 
G

Guest

The Session_End event is fired on the server and is completely independent of
whether the user whose session it was is still there or even still has their
browser open to show them anything.

If you check for a valid session variable at the top of every page that is
important, this will allow you to redirect the user to a login page or
whatever. In this case, the user is definitely there and you have something
you can do. However, there is no httpcontext for the current user and page in
the Global.asax "Session_End" event.
Peter
 
H

Hans Kesting

I would like to show the user that the Session has timed out. I know I
have to use some kind of timer in Session_OnEnd that will refresh the
page at the end. I'm just not sure how to implement the code. Could
anyone help?

There is no way that you can tell the user this from the server (as the
others pointed out).
What you *can* do is use client-side javascript to alert the user.
See the setTimeout function.

something like
setTimeout("alert('your session has ended')", 20*60*1000)

(note: your session timeout is reported in minutes, this javascript
timeout is in milliseconds)


Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top