User Management Asp.net mvc

In the asp.net mvc default application, you get an account controller that allows you to register a user, register, log out and change the password.

I was wondering if it is possible to implement litle more than letting the administrator delete some users or provide some users with different roles, for example, in the asp.net configuration, where do you create users, asign roles and roles for users?

I already figured out and expanded the profile for users, so now they have much more information and a profile.

If you have experience or user management examples in asp.net mvc.

+4
source share
4 answers

Although it's a bit dated, perhaps this project can give you some tips on how to implement membership administration in ASP.NET MVC:

ASP.NET ASP.NET Membership Starter Kit

Quote

What is Membership in ASP.NET MVC Starter Kit?

The starter kit currently consists of two things:

  • A sample website containing the required controllers, models, and views for administering users and roles.
  • A library that provides testable interfaces for user administration and amp; roles and specific implementations are those interfaces that have built-in membership and the roles of Asp.Net providers.

Out of the box, the starter kit gives you the following features:

  • a list of users
  • List of roles
  • User Account Information
  • Change Email
  • Change user roles

Update

To restrict certain operations to specific user roles, you can create these roles using the project that I mentioned earlier, and then decorate your own application controllers and / or actions with the Authorize attribute, referencing the necessary roles:

[Authorize(Roles = "Administrator, HR")] public ActionResult DeleteUser(int UserId) { // do something } 

This will allow non-administrator or HR users to delete users.

+2
source

Here is my attempt to reuse users and roles: https://github.com/Epstone/Simple-MVC-User-Management

+1
source

If I were you, I would create an Admin module that handles all these things. I don’t know any asp.net documentation, but if you look at the PHP documentation (Zend Framework, CakePHP or another), you will get the basic ideas of the structures that you should use to achieve this. Just do not forget to keep things separate, the admin material is included in the administrator module, and not in the user module (but, possibly, the user controller inside the administrator module).

0
source

I answered a similar question: User Management in ASP.Net MVC 3

This provides you with a user management tool with MVC 3 Razor. This does not include roles, but if you get to that, it should not be difficult to add.

0
source

All Articles