Export (0) Print
Expand All

RoleGroupCollection.GetMatchingRoleGroup Method

Returns the first role group that contains the specified user account.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public RoleGroup GetMatchingRoleGroup(
	IPrincipal user


Type: System.Security.Principal.IPrincipal

An IPrincipal that represents the user account to find the role group collection.

Return Value

Type: System.Web.UI.WebControls.RoleGroup
A RoleGroup representing the first role group in the collection that contains the specified user account. If the user is not part of a role group in the collection, it returns null.


user is null.

The GetMatchingRoleGroup method searches the role group collection and returns the first role group that contains the specified user account. The method searches the collection in the order role groups are added to the collection, and returns only the first matching role group.

If the specified user account is not part of any of the role groups in the collection, null is returned.

You must configure role management to use the GetMatchingRoleGroup method. For more information, see Understanding Role Management.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft