I'm trying to load an authenticated user's roles, since I need the data in every page I thought it best to add the code in _Layout.cshtml.
  1. @using Microsoft.AspNetCore.Identity  
  2.   
  3.   
  4. @{  
  5. if (User.Identity.IsAuthenticated)  
  6. {  
  7. UserManager userManager = new UserManager();  
  8.   
  9. var rolesArray = userManager.GetRolesAsync(User.Identity.??);  
  10. }  
  11. }  
  12.   
But I can't seem to find out how exactly I can do that in the given context.
Can anyone here help?
PS: This might not be the best solution, but since I'm rather new @ this I would like to continue in this direction for the time being