In-depth analysis of ASP. NET's Learning Series-HttpHandler (III)

Source: Internet
Author: User

  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

    

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.