How to handle session state events..?

Asked By hitesh kumar
28-May-07 10:20 AM
Earn up to 0 extra points for answering this tough question.

Hi,

I am trying to handle the Session.Timeout[..] event in the .aspx page and want to display a message, before the session got expired "That your session will be expire in 5 minutes"

can any body help me out.?

Hitesh Kumar

 

  Session normally has a sliding expiration.

Peter Bromberg replied to hitesh kumar
28-May-07 02:45 PM

So if you have Session timeout set for 30 minutes, if a user sits with the same page in their browser for 29 minutes and does nothing, and then requests a new page, they now have another 30 minutes of Session.

Does that help? Everything about Session works when a page is requested. Therefore, the concept of "notifying" a user that their session is "about to timeout" is a moot point.

  Hi sir,

hitesh kumar replied to Peter Bromberg
29-May-07 12:06 AM

Hi,

I know that session works when a page is requested,but actually what i want to do when 5 mintutes left to expire the Session,I just want to display a message to user "That your session get expired in 5 minutes" when he does nothing.

It is a kind of buzz! to user...

so,how could i use Session.TimeOut[..] in .aspx page?

(Hitesh Kumar)

Thanks

 

  Use HTML/Javascript for a "hybrid" solution...

Sean Patterson replied to hitesh kumar
29-May-07 06:16 PM
If you want to "buzz" the user to see if they're still around (my old bank site did this), you're going to have to use Javascript to have a Timeout feature. If your Session timeout is 30 minutes, your Javascript needs to fire off in 25 minutes with its alert box.

In a related note to all of this, don't forget you have the server DLL processing your app and the client code being generated. To keep a "robust" timeout in place, you need to put any necessary code in your Session_Timeout method of the Global.asax, and then use HTTP meta tags, Javascript, ClientRegisterScriptBlock to make the web page itself do your timeout functioning. I typically have a logout page that the user is redirected to via a script registration block once the allotted time is reached. I keep this value in my web.config file.

That way, after 30 minutes have expired, the proper session abandonment happens behind the scenes and the client page is redirected to a logout page to avoid any kind of confusion.
  hi sir,
hitesh kumar replied to Sean Patterson
30-May-07 02:48 AM

Thanks a lot sir.

I think this will help me out...

Thanks

(Hitesh Kumar)

Create New Account