Registration and use of the HTTP module of ASP. NET and the HTTP module of the processing program

Source: Internet
Author: User

Register the HTTP module in the configuration file

After the HTTP module is created and copied to the bin directory of the Web application or Global Assembly Cache. config or machine. config.

We can use the

Because configuration settings can be inherited, subdirectories inherit configuration settings from the parent directory. As a result, subdirectories may inherit some unwanted HTTP modules (which are part of the parent configuration information). Therefore, we need a method to delete these unnecessary modules. You can use the <remove> node. If you want to delete all HTTP modules inherited from the application, you can use the <clear> node.

The following code is a common example of adding an HTTP module:

 
 
  1. <httpModules>  
  2. <add type="classname, assemblyname" name="modulename" />  
  3. <httpModules> 

The following code deletes an HTTP module from an application:

 
 
  1. <httpModules>  
  2. <remove name="modulename" />  
  3. <httpModules> 

In the preceding XML:

· The Type attribute specifies the actual Type of the HTTP module in the form of class and part names.

· The Name attribute specifies the friendly Name of the module. Other applications can use this name to identify the HTTP module.

How to Use the HTTP module during ASP. NET running

The HTTP module is used to implement some special functions when ASP. NET is running. The following snippet is from the machine. config file. It displays the HTTP module installed during ASP. NET runtime:

 
 
  1. <httpModules>  
  2. <add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/>  
  3. <add name="Session" type="System.Web.SessionState.SessionStateModule"/>  
  4. <add name="WindowsAuthentication" 
  5. type="System.Web.Security.WindowsAuthenticationModule"/>  
  6. <add name="FormsAuthentication" 
  7. type="System.Web.Security.FormsAuthenticationModule"/>  
  8. <add name="PassportAuthentication" 
  9. type="System.Web.Security.PassportAuthenticationModule"/>  
  10. <add name="UrlAuthorization" 
  11. type="System.Web.Security.UrlAuthorizationModule"/>  
  12. <add name="FileAuthorization" 
  13. type="System.Web.Security.FileAuthorizationModule"/>  
  14. </httpModules> 

ASP. NET uses the preceding HTTP modules to provide some services, such as identity authentication and authorization, dialog management, and output buffering. These modules are registered in the machine. config file.

  1. HTTP module and processing program of ASP. NET
  2. HTTP module of ASP. NET and request handling process of processing programs
  3. Execution of the HTTP module and processing program of ASP. NET
  4. Session Status of HTTP modules and handlers of ASP. NET
  5. ASP. net http module and processing program module implementation

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.