System.Web.UI.WebControls.RoleGroup.ContainsUser Method

Indicates whether the specified user is a member of any of the roles in the role group.

Syntax

public bool ContainsUser (System.Security.Principal.IPrincipal user)

Parameters

user
The user name to look for in the role group.

Returns

true if the user is a member of one of the roles associated with this role group; otherwise, false.

Remarks

The RoleGroup.ContainsUser(System.Security.Principal.IPrincipal) method returns true if the specified user is a member of any of the roles associated with this role group. Roles are searched in the order they are listed in the RoleGroup.Roles property, and searching stops after the first match is found.

This method uses the System.Web.Security.Roles.IsUserInRole(string, string) method to determine whether a user is a member of a role. You must configure role management to use the RoleGroup.ContainsUser(System.Security.Principal.IPrincipal) method. For more information, see Understanding ASP.NET Role Management.

Requirements

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