count instances of the Page class

  • Thread starter Thread starter SteveS
  • Start date Start date
S

SteveS

Hello all. Is there a way to count the number of instances the Page classes
in a particular moment? I was just trying to think of a way to determine
the total number of people that is on the web server at a particular time.
Or, are there any better ideas?

Thank you,

Steve
 
Counting instances of the Page class won't help. Instances of the Page class
last for anywhere for a few milliseconds to less than a minute. At any given
moment, only a small portion of the users accessing your site will have a
pending Page request on the server (most of the time they will be looking at
the downloaded content in their browser). Create a Cache variable at
Application_OnStart that is initialized to 0. In the Session_OnStart Event
handler, increment the value. In the Session_OnEnd Event handler, decrement
the value. Now, this will not tell you exactly how many people are accessing
your site at any given time (nothing will), because the Sessions end when
they time out, but it will give you the best count that you can have.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top