Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Session_End Event

Session_End Event

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pradhip
    wrote on last edited by
    #1

    Hi: I am wondering when exactly does the Session_End event fire in ASP.NET . It does not on the browser close event.Some say it's fired just after the Session_Timeout event occurs. So i have a piece of code just like in asp to find out who are all the active users on my website.The Session_Start event fires and user count is incremented.I have a corresponding user_decrement step in Session_End.The application is set to 1 minute. Now i open a browser window and usercount is 1 at 5.16pm and then i close window IMMEDIATELY. Then immeditaely i open another and browser and usercount is 2 at 5.16pm and i close it immediately. then i open another at 5.18pm and usercount is 3 while i expected it to be 1. AND THEN I openone at 5.22pm and the user count is 4 while i expected it to be 1. So now im surprised.Does the session-end event ever fire at all?? Or am i missing something somewhere?? Any help is appreciated.. Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ?? If a Building is Completed then why do they call it BUILDING ??

    L P 2 Replies Last reply
    0
    • P Pradhip

      Hi: I am wondering when exactly does the Session_End event fire in ASP.NET . It does not on the browser close event.Some say it's fired just after the Session_Timeout event occurs. So i have a piece of code just like in asp to find out who are all the active users on my website.The Session_Start event fires and user count is incremented.I have a corresponding user_decrement step in Session_End.The application is set to 1 minute. Now i open a browser window and usercount is 1 at 5.16pm and then i close window IMMEDIATELY. Then immeditaely i open another and browser and usercount is 2 at 5.16pm and i close it immediately. then i open another at 5.18pm and usercount is 3 while i expected it to be 1. AND THEN I openone at 5.22pm and the user count is 4 while i expected it to be 1. So now im surprised.Does the session-end event ever fire at all?? Or am i missing something somewhere?? Any help is appreciated.. Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ?? If a Building is Completed then why do they call it BUILDING ??

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      Session time out is usaully 20 minutes but it can be adjusted, not sure where though. Im not sure if the sessionend event ever gets "fired" by the browser. Hope it helps :) MyDUMeter: a .NET DUMeter clone

      P 1 Reply Last reply
      0
      • L leppie

        Session time out is usaully 20 minutes but it can be adjusted, not sure where though. Im not sure if the sessionend event ever gets "fired" by the browser. Hope it helps :) MyDUMeter: a .NET DUMeter clone

        P Offline
        P Offline
        Pradhip
        wrote on last edited by
        #3

        I can change the Session timer in IIS setting for that appln or at the web config file.And yes the browser does not seem to fire the seesion-close event. On the contrary it seems the IIS kind of closes the session just after its timed out and its during this closing session that the session_close event gets fired. But the time gap between the session timeout and the session_close evnt to fire takes awfully long.Infact i'm at loss as to whats to be done. If a Building is Completed then why do they call it BUILDING ??

        1 Reply Last reply
        0
        • P Pradhip

          Hi: I am wondering when exactly does the Session_End event fire in ASP.NET . It does not on the browser close event.Some say it's fired just after the Session_Timeout event occurs. So i have a piece of code just like in asp to find out who are all the active users on my website.The Session_Start event fires and user count is incremented.I have a corresponding user_decrement step in Session_End.The application is set to 1 minute. Now i open a browser window and usercount is 1 at 5.16pm and then i close window IMMEDIATELY. Then immeditaely i open another and browser and usercount is 2 at 5.16pm and i close it immediately. then i open another at 5.18pm and usercount is 3 while i expected it to be 1. AND THEN I openone at 5.22pm and the user count is 4 while i expected it to be 1. So now im surprised.Does the session-end event ever fire at all?? Or am i missing something somewhere?? Any help is appreciated.. Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ?? If a Building is Completed then why do they call it BUILDING ??

          P Offline
          P Offline
          Paul Riley
          wrote on last edited by
          #4

          The Session_End fires when the session times out. Opening a new browser will open a new session, but leaving a site and then reentering it through the same browser will not open a new session. So the results you got are not surprising. Best thing you can do to demonstrate is to write a piece of code that appends a line to a text file, showing DateTime.Now and the name of the event (Session_Start and Session_End), possibly the current user count as well. * Then open/close a browser * Open another one and leave the site * Open a third one and leave the site * Ten minutes later, go back to the site with the second browser and close * Fifteen minutes later still, go back to the site with the third browser and then close. * Wait an hour and check the text file In theory, every action except the fourth should open a new session. Twenty minutes after each session is USED (as opposed to opened), it should be closed. I'd be interested to see if that theory bears any relation to reality though :-D Paul And you run and you run to catch up with the sun, but it's sinking
          Racing around to come up behind you again
          The sun is the same in a relative way, but you're older
          Shorter of breath, one day closer to death
          - Pink Floyd, Time

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups