From today on, I will take a look at the source code of the DC. Web. httpcompress compression module. I also hope you can discuss it together ~
1. First, let's talk about the entire process. We all know that the following things will happen after you click the URL on the page in the browser:
The browser sends an HTTP request to the server. The server finds the page and returns it to the browser. After the browser downloads the file, it starts to load and render the HTML file. If it encounters CSS, The JS reference will send a request again to download the CSS and JS files, we just need to make some "Hands and feet" when requesting pages and CSS and JS files ".
2. Since we are doing something when processing requests, we must be familiar with the processing process of Asp.net and demonstrate this process well.
When we request an aspxpage from the server, the httprequest will be captured by the inetinfo.exe process and handed to your own registeredISAPIThe default ISAPI processed by aspx is aspnet_isapi.dll. The aspnet_isapi.dll is calledHTTP pipeline (pipeline) sends this requestThe aspnet_wp.exe process, and then the Framework processes the request through httpruntime. After processing, the result is returned to the client.
When an HTTP request is sent to httpruntime, the request continues to be sent.In the httpapplication Factory Container, the container provides an httpapplication instance to process requests, and then enters httpmodule-> httphandler factory-> httphandler in sequence.
WhenAfter the processrequest method is processed, the entire httprequest process is complete ~~
3. How should we design the process to implement the compression module?
I would like to raise two points for you to think about first, and the next article begins to enter the source code stage.
A) each request is sent to an httphandler, which is also the best place to process the request.
B) You can register every event in the lifecycle in httpmodule. Similar
Public VoidInit (httpapplication APP)
{
App. beginrequest + =NewEventhandler (app_beginrequest );
}
4. Think about time ..........................