Skindeep2366
Skindeep2366

Reputation: 1559

Getting Number of connections currently viewing mvc3 application

MVC3 vb.net Application using built in session management. I have an mvc3 application that I would like to add being able to see the current number of users online to whether they are logged in or not. I have tried using:

   Membership.GetNumberOfUsersOnline.ToString

But that only keeps track of current users logged in which is not acceptable in what I am trying to do. Is there any other method that keeps track of connections????

Upvotes: 1

Views: 740

Answers (1)

Jan
Jan

Reputation: 16032

You could hook on the Session_Start and Session_End events in global.asax. Increase a counter in Session_Start and decrease it in Session_End.

Or you can read this article on how to read all users session state via a dirty reflection hack. So you don't have to count yourself.

Upvotes: 2

Related Questions