Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
IsInRole Method

ClaimsPrincipal.IsInRole Method

.NET Framework 4.6 and 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 Overridable Function IsInRole ( _
	role As String _
) As Boolean


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.



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.


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
© 2015 Microsoft