[C #. Net] protect your ASP. NET Applications (4) ASP. NET Website management tools

Source: Internet
Author: User
Document directory
  • 15.7 ASP. NET Website management tools
  • 15.7.1 overview of ASP. NET Website management tools
  • 15.7.2 user management
  • 15.7.3 role management
  • 15.7.4 access rule management
  • 15.7.5 other configurations
15.7 ASP. NET Website management tool 15.7.1 ASP. NET Website management tool Overview

Before that, we manually configure the web. the config file is authorized to manage membership through security controls. In fact, we can also use website management tools to manage all security settings of applications, including:

· User management (membership management)

· Role management

· Access rule management (authorization)

You only need to select ASP. NET configuration in the IDE website menu, and the IDE will automatically open the ASP. NET Website management tool for the current website, as shown in 15-32.

All security configurations are on the security page, as shown in Figure 15-33.

Figure 15-32 start ASP. NET configuration figure 15-33 ASP. NET Website management tool

Note: Using ASP. NET Website management tool to configure website security may modify web. config. Therefore, close the Web. config file before enabling the configuration.

15.7.2 user management

The user management function is only valid for form verification. If the current authentication method is Windows-based identity verification by default, the prompt shown in the figure 15-34 is displayed.

Figure 15-34 user management is only valid for Form Verification

"Hspace =" 12 "src =" http://book.csdn.net/BookFiles/406/img/image070.gif "width =" 206 "align =" Left "> click the select authentication type link, and then select the over the Internet option, as shown in Figure 15-35.

Figure 15-35 select an authentication method

As shown in Figure 15-36, you can now see some features of user management.

Click the "create user" link to create a user account, as shown in Figure 15-37.

Click "Manage Users" to manage existing users: search, edit, delete, and configure roles, as shown in Figure 15-38.

Figure 15-36 user management Figure 15-37 create a user

Figure 15-38 Manage Users

The role is not enabled yet. All created users are stored in the aspnetdb database.

15.7.3 role management

If role management is not enabled, the page shown in "15-39" is displayed.

After you click the "enable role" link, the page is displayed as 15-40.

Figure 15-39 role management disabled figure 15-40 role management enabled

At this time, the <system. Web> node of Web. config has an additional Configuration:

<Rolemanager enabled = "true"/>

Click Create or manage roles to create, modify, and delete roles, as shown in Figure 15-41.

Figure 15-41 role management

Here, we have created a new manager role, but we have not associated any users with this role, nor authorized this role. Now we use the user management function to create a user named salesmanager and associate it with the manager role at the time of creation, as shown in Figure 15-42.

Figure 15-42 create a user and associate a role

Of course, for created users, you can also associate roles by using the edit role function in the management user, as shown in figure 14-43.

Figure 15-43 edit a role

You can also associate a role in role management, as shown in Figure 15-44.

Figure 15-44 Add a user to a role

It is much easier to associate multiple users with a role at a time. Here, we search for all users whose usernames contain the words "manager" and associate them all with the role "manager. The created roles and associations between users and roles are stored in the aspnetdb database.

15.7.4 access rule management

Access rule management is used to authorize a user or role to access a path, as shown in Figure 15-45.

Figure 15-45 access rule management

"Hspace =" 12 "src =" http://book.csdn.net/BookFiles/406/img/image081.gif "width =" 153 "align =" Left "> to demonstrate, create a Reports folder under the root directory of the website, assume that the folder contains report files in the memory, which can only be accessed by managers. We create a default. aspx in this folder and place a loginname control on the page.

This is the report page. <asp: loginname id = "loginname1" runat = "server"/>

Click the "Create access rule" link, as shown in Figure 15-46.

Figure 15-46 create an access rule

Select the reports folder, select "role", select the previously created role "manager", and then select "allow" in the permission section ". This combination allows the manager role to access the reports folder. To meet our requirements, in addition to allowing the manager to access folders, other people (roles) need to be prohibited from accessing folders. After you click "OK" to save the access rule, click the "Create access rule" link again to create a denial rule: specify that all users have access permissions to the Reports folder as denied.

Click the "manage access rules" link, as shown in Figure 15-47. You can see that the website is an access rule for each folder.

Figure 15-47 manage access rules

Now, let's test these security configurations. Start default. aspx in the reports directory. The page is automatically redirected to the logon page. You can try to log on with the following User:

· Test (does not belong to any role ). You cannot access default. aspx in the reports directory even if you log on.

· Salesmanager (belongs to the Manager User Group): After logon, you can access default. aspx in the reports directory, as shown in Figure 15-48.

Figure 15-48 Report page

In fact, the configuration of these access rules is saved in the web. config file of the corresponding folder. Open the Web. config file in the Reports folder and you can see the following configuration:

<? XML version = "1.0" encoding = "UTF-8"?>

<Configuration>

<System. Web>

<Authorization>

<Allow roles = "manager"/>

<Deny users = "*"/>

</Authorization>

</System. Web>

</Configuration>

15.7.5 other configurations

In addition to security-related configurations, we can also use the website management tool to perform some other configurations, as shown in Figure 15-49 and Figure 15-50 respectively refer to the SMTP server and the configuration interface for debugging/tracking.

Figure 15-49 configure SMTP server figure 15-50 configure debugging and tracing

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.