Using winform to manipulate webform -- talking about IHttpHandler-Windows development-. NE

Source: Internet
Author: User
Tags http request
I have read an article about custom IHttpHandler for a long time. I wanted to write my own experiences, but I have never had time. Let's talk about this today. First, let's talk about some parameter passing and page targeting methods in asp.net.
First, asp.net uses Page. Navigate () to call the URL of the new Page. Page. Navigate () returns an http status code 302 to the browser, allowing the browser to request the new URL to the server. This navigation method requires two rounds between the client and server for each customer request. Second, any information to be passed to the new page must be used as URL parameters, stored in sessions, or stored in the database for the new page to obtain the information. Traditional asp developers are used to this practice, but other web programmers have more advanced methods. However, the two pages are obviously dependent, and the dependency is not captured by the compiler and is not easily modeled at the design stage. Therefore, when debugging, whether the parameter is correctly passed is checked by ourselves. In addition, traditional data transmission methods may expose some key data. More importantly, this makes the object-oriented design very complex. Of course, I did not deny the traditional method. I am emphasizing that asp.net lacks support for communication between multiple pages on the server.
However, we can customize httphandler to expand this support.
Before starting, let's take a look at how asp.net processes page requests. asp.net is handled through an instance of the System. Web. UI. PageHandlerFactory class. PageHandlerFactory depends on another class PageParser. When a page is requested for the first time, PageParser compiles it into a real. Net class and caches compiled instances.
HttpApplication
    |
| 1. GetHandler ()
    |
PageHandlerFactory
    |
| 2. GetCompiledPageInstance ()
    |
PageParser
The first step is to generate the override page provided by asp.net. Therefore, we must create a class to implement the IHttpHandlerFactory interface. We only need to implement two methods: GetHandler (), which is called at the beginning of an HTTP Request; the other is ReleaseHandler (), which allows IHttpHandlerfactory to be cleaned up.

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.