SqlMembershipProvider::GetNumberOfUsersOnline Method ()

 

Returns the number of users currently accessing the application.

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

public:
virtual int GetNumberOfUsersOnline() override

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.

System_CAPS_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
Available since 2.0
Return to top
Show: