Monday, April 26, 2010

How to get the online user count in a website

1) Add the tag in your web config file under system.web tag.

membership defaultprovider="TestProvider"
providers
add name="TestProvider" type="System.Web.Security.SqlMembershipProvider" connectionstringname="Test"
providers
membership


2) Use sql server for session state

3) int count = Membership.GetNumberOfUsersOnline();

No comments: