Questions tagged [role-manager]

43 questions
1
vote
0 answers

Remove roleClaims at one Query shot asp.net Core

I am using asp.net core RoleManager to perform roleClaim(permission) based authorization. The below code work fine but it take too much time execute because i delete the roleclaim each at a time. but i want to delete roleclaims(permission) at one…
BPun
  • 83
  • 2
  • 12
1
vote
0 answers

assign multiple roles for a user in aspnet identity

I have requirement to add multiple user roles for a particular user in user creation phase. So I'm going to achieve this using checkboxes in front end so this the viewpage @model project_name.Models.RegisterViewModel @{ } @using…
kez
  • 2,273
  • 9
  • 64
  • 123
1
vote
1 answer

Default Role Provider could not be found asp.net

In my web config file I gave written this block of code
mohsinali1317
  • 4,255
  • 9
  • 46
  • 85
1
vote
1 answer

Role Manager not enabled. Even after changing web.config

I have enabled role manager in web.config, but am still getting the error: System.Configuration.Provider.ProviderException : The Role Manager feature has not been enabled. I am using nunit, and this is my test method [Test] public void…
Rohan Sampson
  • 61
  • 1
  • 1
  • 7
1
vote
1 answer

Alternative to Roles.IsUserInRole("rolename") using Web.config location element

Let me start by saying that what I have works - I just don't like it. I have a web.sitemap that is used for my navigation bar. Some of the nodes are accessible by everyone, some of them have roles assigned (so that the node won't be shown to users…
Mike
  • 643
  • 3
  • 10
1
vote
2 answers

there is no roleManager tag in web.config

I am using Asp.Net with MVC4. This is my Seed method: protected override void Seed(eManager.Web.Infrastructure.DepartmentDB context) { context.Departments.AddOrUpdate(d => d.Name, new Department() { Name = "Engineering"…
MSH
  • 147
  • 4
  • 10
1
vote
1 answer

How to set a the role type text in the .Net Role Provider?

In my UserController.Login action, I am trying to AddUserToRole() for an authenticated user, with the value of one of the user entity's MembershipType.MembershipName navigation property: Roles.AddUserToRole(thisUser.UserName,…
ElHaix
  • 12,846
  • 27
  • 115
  • 203
1
vote
3 answers

RoleManager and SimpleMembershipProvider cannot be used with AuthorizeAttribute

I have an Asp.Net MVC 5 application. I want to use user roles to authorize only some people to use a specific action. I've changed my Web.config file like this:
0
votes
2 answers

Cannot create and grant role to user in Program.cs

The project is ASP.NET Core MVC, .NET 6. I'm trying to seed a role if it's not there yet and create a user that will have this role. I tried every way to twist the code and it doesn't work. When I run the app for the first time, the following error…
FadoBagi
  • 161
  • 1
  • 9
0
votes
1 answer

Error Could not load type 'TrollMarket.web.MyRoleProvider.RoleSite'

Like the title said there is an error with the roleManager here's the web.config code:
0
votes
0 answers

Spring boot Authorization with external role server

I am trying to implement a role management for in spring boot APIs. I went through the link but I could not get the below details 1. Here they are using @Secured, I am not sure when actually role verification is called Because there is a separate…
scoder
  • 2,451
  • 4
  • 30
  • 70
0
votes
1 answer

Can't Create New Role In dotnet Core 2.1

I've been reading the dotnet core Authentication Documentation and trying to do some examples. I am able to create new users, but I ran into an issue with creating new roles. When I called the RoleManager.CreateAsync, it does not create the new…
Josiane Ferice
  • 921
  • 5
  • 15
  • 31
0
votes
2 answers

AspNet.Idendity: determine whether the user is in a specified Role

I am programming an WebApp with MVC5 and I will check if a User is in a specified Role. Therefore I have tried to use User.IsInRole("Role") but it throws an Exception. I have tried with importing AspNet.Identity and using the User Manager but it…
0
votes
0 answers

The entity type IdentityRole is not part of the model for the current context (MVC Role Manager)

I am pretty new to MVC. I am working role manager. Before this, I changed user id datatype to int from string. Now, I would like to have roles in my website. I have created page and added code to run that part. After running website, When I click on…
user7090664
  • 45
  • 1
  • 9
0
votes
1 answer

MVC - Roles.AddUserToRole throws ProviderException. The user @username was not found

This is my first time using RoleManager, and I am having a problem adding a username to a role. The goal is to check if the user (who is currently logging in) is an admin or not (isAdmin = 1 in SQL database). What I am using in my LoginController…
bankey
  • 189
  • 12