Asp. Net: Windows-based authentication

Source: Internet
Author: User
Tags anonymous config iis net root directory
Asp.net|window If you configure ASP.net to use Windows authentication, IIS uses the configured IIS authentication mechanism to perform user authentication. The steps for enabling Windows authentication are as follows:

(1) Configure the Web.config file.

<authentication mode= "Windows"/>

(2) Start the Internet Information Service (IIS) of the system first, right-click the node in this directory of the Web site, and select the Properties command. As shown in Figure 12.3.


Figure 12.3 Starting IIS

(3) Select the Directory Security tab in the Open window, and then click the Edit button in the anonymous access and authentication control column, as shown in Figure 12.4.


Figure 12.4 Selecting the Directory Security tab

(4) In the pop-up window select "Anonymous access", namely: Allow Anonymous access. Then fill in the username and password, and select Integrated Widows authentication. As shown in Figure 12.5.


Figure 12.5 Completing the Windows user name and password


Windows-based authentication is done with the above settings. The Windows identity of each virtual directory can inherit the identity of the root directory, or it can have its own Windows identity, and you can set permissions on each Windows identity as needed. For example, for Windows authentication based on user groups, you can add the following code in Web.config:

<authorization>
<deny user= "DomainName\UserName"/>
<allow roles= "Domainname\windowsgroup"/>
</authorization>

In practical applications, Windows authentication is often combined with downstream resources, such as databases, to complete authentication.

Summary of this chapter

This chapter mainly introduces how to implement the security control of Web program in asp.net. Firstly, this paper introduces the principle and process of Web application security control, then introduces the basic knowledge of Web.config file, and finally introduces two kinds of security control modes commonly used in practical applications: forms-based authentication and windows-based authentication.



Related Article

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.