Session_OnEnd not being called

Results 1 to 5 of 5

Thread: Session_OnEnd not being called

  1. #1
    Branton Boehm Guest

    Default Session_OnEnd not being called

    Hello there. I&#039;m trying to keep a count of active users on my site. It&#039;s a fairly simple plan:<BR><BR>In Application_OnStart, set an application variable to 0.<BR>In Session_OnStart, increment that application variable.<BR>In Session_OnEnd, decrement that application variable.<BR><BR>However, the count never goes down, which leads me to believe that Session_OnEnd is never being executed. Also, in Session_OnStart, I&#039;m setting Session.Timeout = 10.<BR><BR>Has anyone else had this problem or know of a way to force Session_OnEnd to be called when the Session timeouts?<BR><BR>Thanks a ton,<BR> Branton Boehm<BR>

  2. #2
    Heaven's martini Guest

    Default RE: Session_OnEnd not being called

    The global asa is so buggy you can&#039;t rely on it.<BR><BR>however the on_end should fire some, have you debugged it?<BR><BR>I gotta wonder if your code isn&#039;t a bit buggy.<BR><BR>

  3. #3
    Branton Boehm Guest

    Default Here's the code...

    Here is the code that does the "Active User" count in global.asa. I&#039;ve taken out other code that doesn&#039;t affect the Application("ActiveUsers") variable. Do you see anything wrong with it?<BR><BR>&#060;SCRIPT LANGUAGE=JScript RUNAT=Server&#062;<BR>function Session_OnStart() {<BR> Application.Lock();<BR> Application("ActiveUsers") = Application("ActiveUsers") + 1;<BR> Application.UnLock();<BR><BR> Session.Timeout = 10;<BR>}<BR><BR>function Session_OnEnd() {<BR> Application.Lock();<BR> Application("ActiveUsers") = Application("ActiveUsers") - 1;<BR> Application.UnLock();<BR>}<BR><BR>function Application_OnStart() {<BR> Application("ActiveUsers") = 0;<BR>}<BR>&#060;/SCRIPT&#062;

  4. #4
    Heaven's martini Guest

    Default RE: Here's the code...

    Hmm<BR><BR>one thing, i think you are supposed to set your application var to a local var, do the increment/decrement and then set the application var to the local var.<BR><BR>i doubt that is the problem but i think its considered good practice, unfortunately i am not up on the global.asa stuff. <BR><BR>good luck

  5. #5
    Branton Boehm Guest

    Default RE: Session_OnEnd not being called

    I added a bit to my global.asa file to write to a text file when Session_OnStart and Session_OnEnd are called and it confirmed that Session_OnEnd is never being executed. It writes to the file when the Session starts, but not when it times out. Which means that the function isn&#039;t being called.<BR><BR>Anyone else experienced this or know how to fix it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts