Http create a custom module class

1. The need to implement the interface IHttpModule

    The interface has two methods Init and Dispose, respectively, to complete the initialization of the module and the module to release the resources used in the work.

2. We can be registered in the Init event of Applicatoin

3. explained in the Web.config configuration file

IIS7.0 difference and previous versions: Note

  (1) IIS6.0

    < Configuration > 
      < System.Web > 
        < the httpModules > 
          < the Add name = "custom name" type = "class name interface implemented IHttpModule namespace comprises the fully qualified name" /> 
        </ the httpModules > 
      </ System.Web > 
    < / the Configuration >

  (2) IIS7.0

    < Configuration > 
      < the system.webServer > 
        < modules >
          < the Add name = "custom name" type = "class name interface implemented IHttpModule namespace comprises the fully qualified name" />
        </ modules >       </ the system.webServer >     < / the Configuration >    

Reproduced in: https: //www.cnblogs.com/liuming8080/archive/2013/01/12/2857678.html

Guess you like

Origin blog.csdn.net/weixin_33709364/article/details/93306970