In order to monitor load on a site I've built and support, I wanted to add a simple counter to show how many active sessions were currently being handled by the web application. The first technique was to use a counter variable held in the Application context. This was pretty straightforward - in global.asax increment the counter in the Session_Start event and decrement in the Session_End: 1 Sub Session_Start( ByVal sender As Object , ByVal e As EventArgs) 2 3 'Increment session count 4 Application.Lock() 5 Application( "SessionCount" ) += 1 6 Application.UnLock() 7 8 End Sub 9 10 Sub Session_End( ByVal sender As Object , ByVal e As EventArgs) ...
Senior Developer and head of DXP at Umbraco. Previously with Zone, building solutions primarily on .NET and using Umbraco, EPiServer and Sitecore CMS. This blog is used as a repository for various tips, tricks, issues and impressions drawn from the use of technology my work and interests. All words are my own.