J
Jeff Clark
Hiya!
How would i get this number? thanks!
How would i get this number? thanks!
Ray at said:Sub Session_OnStart()
Application.Lock
Application("SessionCount") = Application("SessionCount") + 1
Application.Unlock
End Sub
Sub Session_OnEnd()
Application.Lock
Application("SessionCount") = Application("SessionCount") - 1
Application.Unlock
End Sub
In your global.asa.
Ray at work
Randy Rahbar said:I love you too Jeff. :]
Stop guys.. I'm getting teary eyed.
Jeff Clark said:Ray, take my clothes out of the dryer when you get home please
Randy Rahbar said:I love you too Jeff. :]
Stop guys.. I'm getting teary eyed.
You will need this too, I think:
Sub Application_OnStart
Application("Active") = 0
End Sub
for over 3 years and at the end of the day, the counter is always zero.
inetinfo.exe or something, it fire then, but as soon as you did that, you'd
have zero sessions anyway.
Aaron Bertrand - MVP said:I don't know the exact circumstance, but I had a site with a session timeout
of 20 minutes. One time the provider went down, so you couldn't ping the
box from outside (but I was inside, so could see the database, etc). I had
code in session_onEnd that cleaned out sessions from the database, and I had
about 30 active sessions at the time the site went down (easily queried
right after it happened; I was thinking, "oh crap, how many users did that
affect?"). I did a query 10 minutes later, and there were still 12 active
sessions (so 18 of them must have hit session_onEnd). 10 minutes later
(when all of the session_onEnd() calls should have completed), there were
still 5. An hour later, there were still 5. IIS was still running, nothing
had been restarted, etc.
So, in Jeff's
particular circumstance, it wouldn't matter, since the application variables
would be gone anyway
I don't follow... can you elaborate? The application variables were not
gone in my scenario... the server was still running, but session_onEnd did
not fire for 5 of the 30 sessions. So, application("SessionCount") =
application("SessionCount") - 1 left application("SessionCount") 5 too high.
And this was NOT corrected when the server came back online, because the
only symptom of that was that users could hit the server again (the server
itself wasn't down; the provider's pipe was down).
theAnyway, I updated http://www.aspfaq.com/2491 with a slightly more reliable
method using SQL Server (that still, admittedly, can leave sessions to be
counted as "active" until the timeout, when they really aren't truly
active... but it will never let a failed session_onEnd permanently spoil
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.