I want to write something about RoleManager.

Source: Internet
Author: User

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.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.