Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
GetNumberOfUsersOnline Method

SqlMembershipProvider.GetNumberOfUsersOnline Method

Returns the number of users currently accessing the application.

Namespace:  System.Web.Security
Assembly:  System.Web (in System.Web.dll)

abstract GetNumberOfUsersOnline : unit -> int  
override GetNumberOfUsersOnline : unit -> int

Return Value

Type: System.Int32
The number of users currently accessing the application.

This method is called by the Membership class to retrieve the number of users considered online from the SQL Server database specified in the ASP.NET application's configuration file (Web.config).

GetNumberOfUsersOnline returns the number of users of the current application whose last activity date and time is greater than the current date and time less the value of the UserIsOnlineTimeWindow property in minutes.

Only users associated with the configured ApplicationName are included in the count.

The following code example returns a list of users with a count of the users currently online.

NoteNote

This example uses the Membership class to call the SqlMembershipProvider specified as the defaultProvider in the Web.config file. If you need to access the default provider as the type SqlMembershipProvider, you can cast the Provider property of the Membership class. To access other configured providers as a specific provider type, you can access them by their configured name with the Providers property of the Membership class and cast them as the specific provider type.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
Show:
© 2015 Microsoft