Export (0) Print
Expand All

ClaimsPrincipal.IsInRole Method

.NET Framework 4.5

Returns a value that indicates whether the entity (user) represented by this claims principal is in the specified role.

Namespace:  System.Security.Claims
Assembly:  mscorlib (in mscorlib.dll)

public virtual bool IsInRole(
	string role
)

Parameters

role
Type: System.String

The role for which to check.

Return Value

Type: System.Boolean
true if claims principal is in the specified role; otherwise, false.

Implements

IPrincipal.IsInRole(String)

The IsInRole method checks whether an identity that this claims principal possesses contains a claim of type ClaimsIdentity.RoleClaimType where the value of the claim is equal to the value specified by the role parameter.

NoteNote

Each ClaimsIdentity has its own definition of the claim type that represents a role. This claim type can be accessed and set through the ClaimsIdentity.RoleClaimType property.

.NET Framework

Supported in: 4.6, 4.5

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.

Show:
© 2014 Microsoft