20.3 IIS 7.0 and Form Verification 2)
However, it is not enough to put ASP content together with ASP. NET-based login pages and configure form verification. Form verification does not work when you try to access a traditional ASP page. Depending on the verification and authorization rules, you may get an "unauthorized" response or direct access to the traditional ASP page without a logon reminder. You will learn more about authorization rules and their behaviors in Chapter 23rd ).
The cause of this behavior is that the HTTP module hosted by default, such as the form verification module, is configured to only execute requests for ASP. NET-based code. Therefore, to make form verification work, You must select the HTTP module configuration feature on the IIS 7.0 console after selecting the Web application to modify this line. Then, open the configuration details of the FormsAuthentication module in the module list, as shown in Figures 20-7 and 20-8.
After enabling the HTTP module configuration feature, you need to find the FormsAuthentication item and double-click it, or click the "edit" link in the taskbar on the right of the Management Console. In the displayed Setting dialog box, disable the "Invoke Only for Requests to ASP. NET Applications or Managed Handlers" option, as shown in 20-8.
After this configuration is complete, When you access the traditional ASP page in the Web application directory, the request will use ASP. NET Form Verification for verification. The Web. config content of the web application is roughly as follows:
| |
| Figure 20-7 select the HTTP module configuration feature in the Web Application |
| |
| Figure 20-8 configuration details of the FormsAuthentication Module |
The configuration of the FormsAuthentication module is very important. Pre-Condition = "" is displayed in the configuration according to the check mark configured in Figure 20-8, and its default value is managedHandler.
On the whole, you can use this method to maximize ASP. NET application capabilities for Web applications configured based on IIS 7.0 Web servers, such as form verification or membership APIs described in Chapter 21st. Compared with the previous version of IIS, this is a huge advantage, and it makes many things easier.
| BibliographyPrevious sectionNext section |