Preface
In the previous section, we discussed that using ISAPI is an important technology that allows us to expand server functions. There are two methods to achieve this: ISAPI extension and ISAPI filter, here we will talk about the ISAPI extension.
Reading directory
I. HttpHandler
II. Implementation of HttpHandler
Iii. HttpHandler Running Mechanism
Iv. Running Effect
5. Relationship between HttpHandler and HttpHandler
I. HttpHandler
HttpHandler implements the ISAPI Extension function. HttpHandler processes requests and sends responses. HttpHandler is an HTTP processing program. All HTTP requests are processed through HttpHandler, however, for a specified type, the implementation of the HttpHandler function is completed by implementing the IHttpHandler interface.
II. Implementation of HttpHandler
2.1 In Intent Service Manager, map the file extension (the file extension you want to process) to ASP. net isapi extension dll (aspnet_isapi.
2.2 compile a class that implements the IHttpHandler Interface
2.3 Register this handler in web. config.
2.4 Running Effect
Iii. HttpHandler Running Mechanism
We often go to the website and see a very strange extension. cgi,. do pull, we can also do this.
Create a new file type. This type of file can only be known by my own program, for example (*. cgi). For this type of file name, let the HTTP handler process it separately.
4. Relationship between HttpHandler
HttpModule is executed and not overwritten, while HttpHandler is different. HttpHandler has a default and custom system. After an Http request comes, determine whether a custom HttpHandler exists, then execute the custom HttpHandler. If there is no custom one, the default one will be executed. Is a two-choice relationship.
V:HttpHandlerAccess Session
5.1 implement the IRequiresSessionState Interface
5.2 register in web. config
5.3 Running Effect