System.Web.Security.Roles.IsUserInRole Method

Gets a value indicating whether the specified user is in the specified role.

Syntax

public static bool IsUserInRole (string username, string rolename)

Parameters

rolename
Documentation for this section has not yet been entered.
username
The name of the user to search for.

Returns

true if the specified user is in the specified role; otherwise, false.

Remarks

The Roles.IsUserInRole(string, string) method calls the RoleProvider.IsUserInRole(string, string) method of the default role provider to determine whether a user name is associated with a role from the data source for the application that is specified in the Roles.ApplicationName property.

If username is equal to the current logged-on user and the Roles.CacheRolesInCookie property value is true, roleName may be checked against the role cache rather than the specified Roles.Provider.

Requirements

Namespace: System.Web.Security
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0