ASP.NET Identity 2.0 check if current user is in role IsInRole

前端 未结 4 578
鱼传尺愫
鱼传尺愫 2020-12-03 10:33

With ASP.NET Identity 2.0 how do you check if the currently logged on user is in a role? I am using the following, but wondering if there is something more efficient.

4条回答
  •  半阙折子戏
    2020-12-03 11:21

    this worked for me hope this helps...

    If HttpContext.Current.User.IsInRole("admin") Then
            adminmnu.Visible = True
        End If
    

提交回复
热议问题