Link to home
Start Free TrialLog in
Avatar of JessyEzzy
JessyEzzy

asked on

Question about Session_Start event

I have this code that runs in Session_Start event to update the last activity date for each user.
I thought that by putting it in Session_Start I will guarantee that when the user access the website this event will fire & updates his last activity date and if the user left the browser idle for more than 20 min when the session is supposed to timeout & he then re-access the site , the event will fire again as the session ended but this seems not to happen.
I have been testing this with IE7, I access the site, session start fires & I can see the activity date updated in the db, I leave the browser idle for more than 20 min then I refresh but the session_start doesn't fire again, only if I opened a new browser and accessed the site but refreshing the same tab seems not to let it fire again.

I don't know if I have explained my issue well but my main question is, is it correct that the session_start event only fires when opening new browser and doesn't fire when leaving the browser idle and then re-accessing the site again thru the same tab or opening a new tab?

Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of Rejojohny
Rejojohny
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JessyEzzy
JessyEzzy

ASKER

I tested it again and the session_start event fired after again but I realized that it does when you leave the whole browser idle what I was doing before is leaving the tab with the website am testing and working on other tabs. So this means that as long am working on other tabs the session won't timeout and I must leave the whole browser window idle and in that case it will fire when reaccessing the site?
>>So this means that as long am working on other tabs the session won't timeout and I must leave the whole browser window idle and in that case it will fire when reaccessing the site?
Yes, session only times out when there is no interaction with the server .. so if keep working on the screen for 20 minutes and there was no interaction with the server (no submits or postbacks), then the session will timeout

Rejo
Well thanks I thought that the session not shared across browser tabs.
oh, you meant browser tabs .. sorry I mistook that for tabs within your application .. I am not sure about browser tabs in the latest version of IE, but session do get shared when you open a new window from a existing browser window .. so i assume that is the same behavior when you open a new tab within the same browser...

Thanks for the points ..

Rejo