Forum Moderators: open
At the beginning of this past week I decided to start playing around with the idea. I set the value to '0' during Application_OnStart, add 1 to the value at Session_OnStart, and subtract 1 at Session_OnEnd.
The problem is that after a few hours, my value goes negative. Initially the number goes up close to 2,000 within the first 20 minutes, and then varies until it goes negative. This is a pretty large site which averages about 30,000 unique visitors per day.
Any ideas on what is going wrong?
But how exactly does an include file help? how can u add 1 to a database each time a page is loaded? And when a user leaves the site how do you then subtract 1 from the text file or database without using a session on end application variable?
Doesnt make any sense to me.
The comment about the pooling seems more logical.....but when the pool is reset should that not cause the global to reset back to an application on start status?
Im also sceptical because whenever the pool resets on our server it usually results in all member being logged out, and our counter goes visibly wrong without ever witnessing a logout....
but when the pool is reset should that not cause the global to reset back to an application on start status
Does application on_start fire up when pools are recycled? I thought it only did when you reeboot/restart IIS.
When the pool recycles all application data is lost but as session data is persited using cookies maybe the sessions stay open. Then when the session ends it goes negative.
It all gets a little confusing now though. If the global variable DOES get reset on the pool, and the logged in sessionID's do keep persisting, surely that makes it almost impossible to build a counter into any ASP website?
Ive never read anywhere else users having such a problem build such a simple item - but perhaps that is because our site is busy and causing the pool to recycle much more often than most other sites tend to and so is more noticeable.
Assuming your theory is correct (and im thinking you could well be!) how on earth can i get around this flaw, aside from not allowing the pool to reset at all?
Logged in members go into a database table so that count is always correct as they are only erased from that table when the ending sessionID matches with the one in the table. Is there a way to count all current SessionID's currently active, and then i can simple subtract the member count from that count....
going to research this some more now. Thank you for your help :)
[aspfree.com...]
use that script there. It works flawlessly for me so far. Good luck with it!