Questions tagged [asp.net-roles]

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.

226 questions
3
votes
1 answer

Asp.Net 3.1 using Windows Authentication and Role Authorisation

setup with Asp.net & .Net Core 3.1, I have upgraded a previous Identity system using UserName/Password with Roles to use Windows Authentication. I have created a ClaimsTransformation which gets the windows Identity and creates a new ClaimsPrincipal…
3
votes
1 answer

Web Site Administration Tool - Type is not resolved for member 'StructureMap.StructureMapException'

I think a picture will serve me best: Any Ideas? My web app works just fine. I don't really use the web site administration tool, I just taught I'd play with it and discovered that the security tab doesn't work and I can't figure out why. I'm…
3
votes
0 answers

MVC - dynamic role management

I have users that have one of those roles: RoleA (Attribute: AuthorizeRoleA) RoleB (Attribute: AuthorizeRoleB) In my controller I want to say this: Everyone that has role of type RoleA can access all the methods in this…
ToTa
  • 3,304
  • 2
  • 19
  • 39
3
votes
1 answer

Get User Roles with ASP.net Identity and Web API

I am currently trying to get the given user's list of Roles and am having some trouble fitting this into the context we are using it in. I was able to get a list of all available roles with this API function…
tokyo0709
  • 1,897
  • 4
  • 28
  • 49
3
votes
2 answers

Authorising role combinations

Further information can be provided if required, first post here! I'm currently managing a website in asp.net mvc4 with the standard role authorisation(webpages_roles/webpages_usersinroles) functionality. This works fine to a point, actionresults…
Zerk
  • 1,595
  • 9
  • 16
3
votes
1 answer

ASP.net Identity OWIN cookie when user roles change?

I'm just getting started with OWIN and ASP.net Identity. This is how I am signing in my users: ClaimsIdentity identity = new ClaimsIdentity( new Claim[] { new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()), new…
Sam
  • 9,933
  • 12
  • 68
  • 104
3
votes
1 answer

MVC4 : User.IsInRole not working properly

I'm using the ASP.NET MVC SimpleMemberShip Provider, There isn't any problem for a while after I logged in. I check if user is Boss, this is working. if (User.IsInRole("Boss")) { //do something } But after a few minutes when I refresh the page…
3
votes
2 answers

GenericPrincipal roles not available in MVC views

In our MVC app, we're by-passing the RolesProvider in favor of just caching our roles in a cookie that will be passed around. Following several suggestions around the interwebs, we're leveraging the Application_AuthenticateRequest event, like so: …
mshubert12
  • 269
  • 1
  • 4
  • 14
3
votes
1 answer

Enable roles without (or with a dummy) Role Provider

I'm following this article in which is described how to assign roles to users when theiy log-in using forms authentication: public void Application_AuthenticateRequest( Object src , EventArgs e ) { if (!(HttpContext.Current.User == null)) { …
etuardu
  • 5,066
  • 3
  • 46
  • 58
3
votes
2 answers

ASP.NET MVC project for management Membership , Role and Profile

every body knows working with Membership , Roles and Profiles are common in most of ASP.NET project. I am looking for a simple project to do this activity with UI for end users. like "add user" , "add role" , "assign user to roles" and so on. It's…
AmirHossein
  • 367
  • 1
  • 8
  • 25
2
votes
1 answer

Set Authentication & Authorize in the controller to dynamically based on User Identity roles

I have a controller that authorizes logged in users based on roles. now we have a generic website that allows users from different companies to login, how do I dynamically restrict the controllers based on roles. Here is my code [Authorize(Roles =…
Ehioze
  • 39
  • 1
  • 4
2
votes
2 answers

Supporting Core Identity Roles in IdentityServer4

I'm creating a Single-Sign-on server using IdentiyServer4. I've looked at their QuickStarts showing how to integrate MS Core Identity with ASP.NET Core 3.1 apps. But there's no examples showing whether ASP.NET roles are natively supported in MVC…
2
votes
1 answer

How should I relate users to domain objects?

I'd like to use the built in ASP.NET membership and role providers to create a system that restricts what each authenticated user can view and edit. The software already has the concepts of "Items" and "Groups". Each Item belongs in a Group. The…
Elbelcho
  • 459
  • 3
  • 13
2
votes
1 answer

Stop document downloads from unauthorised users

I have an application where the admin user can create users and upload documents to the server for the created user to download. When uploading a file it creates a folder using the userid as the folder name and saves in that folder within a folder…
Jammer
  • 2,330
  • 11
  • 48
  • 77
2
votes
1 answer

How to get the number of users in a role

I want to get the number of users that are assigned to a role, something like this see pic I also checked this post but didn't helped me. My RoleViewModel public class RolesViewModel { public RolesViewModel() { } public…
zura
  • 33
  • 3
1 2
3
15 16