?
Solved

Question about Session_Start event

Posted on 2007-10-19
6
Medium Priority
?
242 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:JessyEzzy
  • 3
  • 2
6 Comments
 
LVL 26

Accepted Solution

by:
Rejojohny earned 90 total points
ID: 20110911
>>is it correct that the session_start event only fires when opening new browser and doesn't fire when leaving the browser idle
no, it should have fired for the first case too .. are you sure your session is timing out?

Rejo
0
 
LVL 5

Assisted Solution

by:discon0
discon0 earned 60 total points
ID: 20111128
Rejojohny is right, the event should fire.

Add this to your web.config file to make your session last 1 minute only to help you test this without waiting 20 minutes.

      ...
      <system.web>
            ...
            ...
            <sessionState timeout="1" />
      </system.web>
      ...
0
 
LVL 3

Author Comment

by:JessyEzzy
ID: 20111602
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?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 26

Expert Comment

by:Rejojohny
ID: 20112064
>>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
0
 
LVL 3

Author Comment

by:JessyEzzy
ID: 20112849
Well thanks I thought that the session not shared across browser tabs.
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 20113298
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
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Screencast - Getting to Know the Pipeline
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month15 days, 3 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question