title: ASP.net MVC - Get currently logged user role in view
body: <p>I know that there are a lot of topics about this issue but I already tried several solutions and cannot make it work.</p>
  
  <p>So, I am trying to verify the currently logged user role in my view. As referred in the major part of topics about this in StackOverflow, I just have to do:</p>
  
  <pre><code>@User.IsInRole("Admin")
  </code></pre>
  
  <p>Unfortunately this always returns false even with the "Role" column, in the AspNetUsers table, of the current logged user is populated with "Admin".</p>
  
  <p>I also tried below approach but it says that "UserManager does not exist in current context".</p>
  
  <pre><code>&lt;p&gt;@UserManager.GetRoles(userId)&lt;/p&gt;
  </code></pre>
  
  <p>One of my suspects is that I am not correctly setting the role for the user upon registration. My AspNetRoles table is correctly populated but AspNetUserRoles table is empty.</p>
  
  <p>How can I troubleshoot this to find what is wrong with my application so I can use @User.IsInRole(...) instruction?</p>
  
  <p>Thanks in advance for any help.</p>