SqlMembershipProvider.GetAllUsers Method (Int32, Int32, Int32)
Gets a collection of all the users in the SQL Server membership database.
Assembly: System.Web (in System.Web.dll)
override GetAllUsers : pageIndex:int * pageSize:int * totalRecords:int byref -> MembershipUserCollection
Parameters
- pageIndex
-
Type:
System.Int32
The index of the page of results to return. pageIndex is zero-based.
- pageSize
-
Type:
System.Int32
The size of the page of results to return.
- totalRecords
-
Type:
System.Int32
The total number of users.
Return Value
Type: System.Web.Security.MembershipUserCollectionA MembershipUserCollection of MembershipUser objects representing all the users in the database for the configured ApplicationName.
| Exception | Condition |
|---|---|
| System.ArgumentException | pageIndex is less than zero. - or - pageSize is less than one. - or - pageIndex multiplied by pageSize plus pageSize minus one exceeds Int32.MaxValue. |
This method is called by the Membership class to retrieve user information from the SQL Server database specified in the ASP.NET application's configuration file (Web.config).
The results returned by GetAllUsers are constrained by the pageIndex and pageSize parameters. The pageSize parameter identifies the maximum number of MembershipUser objects to return in the MembershipUserCollection. The pageIndex parameter identifies which page of results to return, where zero identifies the first page. The totalRecords parameter is an out parameter that is set to the total number of membership users for the configured applicationName. For example, if there are 13 users for the configured applicationName, and the pageIndex value was 1 with a pageSize of 5, the MembershipUserCollection returned would contain the sixth through the tenth users returned. The totalRecords parameter would be set to 13.
The following code example returns a list of users in pages of data with a count of the number of users currently online.
Note |
|---|
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. |
Available since 2.0
.jpeg?cs-save-lang=1&cs-lang=fsharp)