Determining an 'active' user count of an ASP.NET site

后端 未结 9 2085
南旧
南旧 2021-01-01 01:36

On an ASP.NET site, what are some techniques that could be used to track how many users are logged in to the site at any given point in time?

So for example, I could

9条回答
  •  旧巷少年郎
    2021-01-01 02:05

    First set Session timeout for 1 minute.

    Create a simple heartbeat.aspx page with no HTML content just the following javascript code:

    
      
      
      
    
    
    
    

    This will re-request itself every 30 seconds and keep session alive.

    Put heatbeat.aspx page in a hidden frame.

    To get user count just get session count by using static counter in Session_Start and Session_End events in Global.asax.

提交回复
热议问题