Share via


UserManagerExtensions.IsInRole<TUser> Method

Returns true if the user is in the specified role

Namespace:  Microsoft.AspNet.Identity
Assembly:  Microsoft.AspNet.Identity.Core (in Microsoft.AspNet.Identity.Core.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function IsInRole(Of TUser As {Class, IUser}) ( _
    manager As UserManager(Of TUser), _
    userId As String, _
    role As String _
) As Boolean
'Usage
Dim manager As UserManager(Of TUser)
Dim userId As String 
Dim role As String 
Dim returnValue As Boolean 

returnValue = manager.IsInRole(userId, _
    role)
public static bool IsInRole<TUser>(
    this UserManager<TUser> manager,
    string userId,
    string role
)
where TUser : class, IUser
[ExtensionAttribute]
public:
generic<typename TUser>
where TUser : ref class, IUser 
static bool IsInRole(
    UserManager<TUser>^ manager, 
    String^ userId, 
    String^ role
)
static member IsInRole : 
        manager:UserManager<'TUser> * 
        userId:string * 
        role:string -> bool   when 'TUser : not struct and IUser
JScript does not support generic types and methods.

Type Parameters

  • TUser

Parameters

Return Value

Type: System.Boolean

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type UserManager<TUser>. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.111) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.111).

See Also

Reference

UserManagerExtensions Class

Microsoft.AspNet.Identity Namespace