Checking login user role in razor page

@if (Request.IsAuthenticated && User.Identity.Name=="administrator") { <div id="sidebar"> <div class="module"> <ul class="menu"> <li>@Html.ActionLink("Home", "Index", "Home")</li> <li>@Html.ActionLink("About", "About", "Home")</li> <li>@Html.ActionLink("Contact", "Contact", "Home")</li> </ul> </div> <div class="mainContent"> Hello, @User.Identity.Name ! </div> </div> This is my layout if the user is authenticated as administrator but this sort of check looks no good, I need to check the role of … Read more

Creating inheritance users from base asp.net identity user

I have problem in which i would like to create N, two in the example, user objects (e.g. Customer & Supplier) which all inherent from the asp.net IdentityUser object. These object have very different additional data besides the the data from the IdentityUser. I would like to use the IdentityUser user as this gives me a flexible way of taking care of authentication and authorization.