Roles.GetUsersInRole Method (String)
.NET Framework (current version)
Gets a list of users in the specified role.
Assembly: System.Web (in System.Web.dll)
Parameters
- roleName
-
Type:
System.String
The role to get the list of users for.
Return Value
Type: System.String[]A string array containing the names of all the users who are members of the specified role.
| Exception | Condition |
|---|---|
| System.ArgumentNullException | roleName is null. |
| System.ArgumentException | roleName is an empty string or contains a comma (,). |
| System.Configuration.Provider.ProviderException | Role management is not enabled. |
The GetUsersInRole method calls the GetUsersInRole method of the default role provider to retrieve the user names associated with a role from the data source. Only the roles for the application that is specified in the ApplicationName property are retrieved.
.NET Framework
Available since 2.0
Available since 2.0
Show: