Prepare to use ASP. NET role permission management. In fact, this is actually done by adding the corresponding assembly to several database tables.
1. Generate a database table: aspnet_regsql
In fact, you should be able to directly create the corresponding table using SQL scripts in the database.
2. Configure database connection
In machine. config, the database connections for Membership and Role are both LocalServer. In actual use, you must reconfigure them to the specified database.
3. Use ASP. NET configuration management tools to manage users and permissions.
The steps are relatively simple. Notes:
1. Open the ASP. NET Website management tool and the database will not be connected
Because the RoleManage and Membership configured in machine. config are the configured LocalServer, if you want to manage role permissions in the database of app_data, You need to enable the local SQL Express service.
2. Only RoleManger is used, and MemberShip configuration is not used:
Use RoleManger, but use Windows Authentication instead of MemberShip,
You must also configure the Membership database connection. For Membershop and Role configurations, you must add <clear/> to clear the configuration in machine. config.
Although membership is not used, you can still use RoleManger to add permissions Using Roles APIs (you can also directly add data to several tables in the database.
3. You can manage your own database tables and use APIs to perform operations. ASP. NET Website management tools can be laid off.
It would be a little troublesome to configure this stuff to be released to the server. You have to add a URL parameter at the end to specify the website. Therefore, you can directly manage database tables without using this tool.
4. if you understand it, you still think that this set of Provider stuff is more effective. If you want to write it yourself later, you can also write your own Provider to replace it.
Just remember that there is no code and no configuration file. Programmers are popular with "speaking with code". Let's talk about it later.