Create “Users”, “Roles”, and “UserRoles” tables using one of the scripts for Advanced Membership and Tables. Configure the custom membership map and generate the project.
Advanced Membership Provider in Action
When the website is first initialized, the standard user accounts admin and user will be created, and can be used to sign in to the web application. Two roles will be created: Administrators and Users. Both accounts will be assigned Users role, and admin will be assigned Administrators role.
Log in and navigate to the Users page.
View the details for any user.
Let’s perform the following enhancements:
- The user should not be able to view the fields Password and Password Answer.
- The data fields will be separated into several categories.
- Is Approved and Is Locked Out will be changed to a check box.
- All date and count fields will be read-only.
- Roles will be added as a many-to-many field.
In addition to these changes, the Users page will be moved to the end of the menu, and will only be visible to administrators.
The final step would be to prevent default CRUD operations from being performed, and create business rules that will use the ASP.NET Membership API to perform updates to the Users and UserRoles table.
This is the final Users grid view.
The final Users form will look like the picture below: