ASP.NET role management helps you to manage authorization, allowing you to specify which resources various users in your application are allowed to access. Role management lets you group users by assigning them to roles.
Questions tagged [asp.net-roles]
226 questions
0
votes
0 answers
IsInRole returning false
I've researched these other two threads that I thought might be related but there issues is different:
Why does IsInRole always return false?
IsInRole problem
I'm checking against a role (string) "DomainName\Booking Reader" for Context.User which I…

Rob Ainscough
- 576
- 5
- 14
0
votes
1 answer
IQueryable Roles how to implement
I need get all roles use roleManager.Roles.
I get Exception "does not implement IQueryableRoleStore", and add to my class RoleStore. And I don't know how to implement this property.Please help
public IQueryable Roles
{
…

Tomoko
- 3
- 2
0
votes
2 answers
How to show a user authenticated, but not authorized in the Nav Menu in Blazor
I'm working on a new application in Blazor. I have asp.net identity setup and working.
Is there a way to be authenticated, but not authorized?
For example, initially we are requiring users to register, but are not adding their roles until we…

tvb108108
- 398
- 3
- 19
0
votes
2 answers
Find User Role ASP.Net Core
Trying to find out where roles are assigned to a particular user in an ASP.Net core app. I'm new to .net core so bare with me. I can debug and see the username and password but cannot figure out where the roles are set for this particular user? If…

PaulR
- 23
- 1
- 7
0
votes
1 answer
Is it possible to write a class that only executes in DEVELOPMENT ENVIRONMENT?
In my startup.cs class I have a check to see if it's DEV environment and has a lot of key-value pairs in my appsettings.json and appsettings.development.json file.
however I want to encapsulate some code that only runs in the DEV environment and…

Ehioze
- 39
- 1
- 4
0
votes
1 answer
User assigned roles remain unrecognised
I am trying to introduce an admin account into my project. I have updated the Startup.cs file to use roles and have added Admin and Standard account inside AspNetRoles and assigned a user using their UserID an admin. The relevant [Authorize(Role =…

Krellex
- 613
- 2
- 7
- 20
0
votes
1 answer
Redirect login user or admin to specific page or view depending upon role in asp.net identity
There are several module in my Asp.net project and several user role also.
I want to do is, if user login to the system, it redirected to User dashboard and admin to admin dashboard. i have used Asp.net Identity for Login and register.

Bibek Timalsina
- 51
- 1
- 9
0
votes
1 answer
mvc role based permission using actionfilterattribute
So I'm setting up my permission for an mvc website. And I'm doing a role based permission, having actions in a controller would require different Roles depending on the purpose of the action.
I know that the most recommended would be…

gdubs
- 2,724
- 9
- 55
- 102
0
votes
1 answer
UserRoles seeding failed
I am developing an ASP.NET Core MVC web application. I employ the Identity UI framework for user authorization and authentication.
I have changed the primary key of all the Identity table to 'int' values (They are string type by default)
In the…

Pawara Siriwardhane
- 1,873
- 10
- 26
- 38
0
votes
1 answer
Role Authorization Not Recognized - ASPNET CORE 5 with IdentityServer4 Cookie/Oidc Authentication
I have implemented Login with IdentityServer4 using Cookie/Oidc Authentication, going straight to the point I can see at the endpoint I have the neccessary claim with the role as you can see in this image:
claims image
role
As you can see the Roles…

antas
- 1
- 1
0
votes
2 answers
make AuthorizationHandler accept two resources instead of one
I have completed this tutorial on authorization in asp.net razorpages.
I have multiple models and would love to allow the Adminhandler to have access to all of the models. The tutorial is structured in a way which uses the C# interface called…

chris1234
- 53
- 6
0
votes
2 answers
Add Roles to User using checkboxes
I am developing a Razor application and I need the Admin to assign or update roles of the Users. I am using a checkbox to carry out this action. So far, I have been able to populate the view to show the users and their respective roles ticked in the…

aasonu
- 95
- 4
- 11
0
votes
1 answer
asp.net Identity Roles organisation unit structure creation
Is it possible to put users created from ASP.NET Identity Roles into an organisational unit as you can in Active Directory? I want to be able to allow users to be put into departments where managers of that department can access other users' data…

GolfBravo
- 837
- 2
- 12
- 23
0
votes
0 answers
How to handle roles when injecting service filter with an authorization attribute?
I'm using ASP.NET Core 2.2 and I have a custom Authorize attribute filter called CustomAuthorize that handles authentication and authorization. The authentication part is handled manually with some code I've written in the OnAuthorization function,…

Lukas
- 1,699
- 1
- 16
- 49
0
votes
1 answer
System.Web.HttpException: 'Unable to connect to SQL Server database using User.IsInRole("string")
It was a problem with one of the packages. The Microsoft.Owin.Host.SystemWeb in venter code hereersion 4.1.0 and Microsoft.AspNet.WebPages.WebData 3.2.7
I have this code:
if (User.IsInRole("CanManageUsers"))
{
return RedirectToAction("Index",…

S_K
- 53
- 7