Probably something like this:
- have a counter in the Application object
- on Session start increment the counter
- on Session end decrement it
This should count all active sessions, but there are some warnings:
- a session is counted until it ends, which is 20 min. after the user has left your site
- I read somewhere (can't remember the link - can someone confirm?)
that Session_OnEnd is not called if nothing was stored in the session.
Another option is to read the corresponding performance counter (and perhaps
cache the value as there is probably no need to have alwxays the exact
value)...
You could also impersonate by code just the time needed to get the counter.
Also you way want to "cache" this value if you don't need the real value at
any one time (is it for admin purpose or to display this to users ?).
By the way I am using C# and the global.asax is VBScript. could this be the
problem why this is not working?
If I use the same code in VB on my page than it does work.
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.