简体   繁体   中英

the number of users online and number of active session

My environment is ASP.Net + IIS 7.0 + Windows Server 2008 + .Net 3.5. I am wondering whether the number of users online and number of active session are the same thing? The other question is, no matter whether they are the same, how to calculate them (ie for a given time, what is the number of users online, and related active number of sessions)?

thanks in advance, George

To you first question, sessions and users are not the same. Each user has a session, but some sessions are not active and do not have users any more. Such sessions are ended automatically by the asp.net engine after a timeout period. ie since http is a disconnected protocol, the web server has no way of knowing if the user is between requests or has just abandoned the session.

If you want to track the number of active session, you can use the session_start and session_end methods of the globals.asax file. You can have a simple counter that increments on start and decrements on end.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM