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 HTTP request will be captured by the inetinfo.exe process and handed over to your own registered ISAPI. By default, aspx processes the ISAPI aspnet_isapi.dll. Aspnet_isapi.dll sends the request to the ASPNET_WP.EXE process through an Http PipeLine (PipeLine). Then, the framework processes the request through HttpRuntime and returns the result to the client after processing.
When an http request is sent to HttpRuntime, the request continues to be sent to the HttpApplication Factory Container, which provides an HttpApplication instance to process the request, go to HttpModule> HttpHandler Factory> HttpHandler.
After the process of the ProcessRequest method in HttpHandler is complete, 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 void Init (HttpApplication app) {app. BeginRequest + = new EventHandler (app_BeginRequest);} copy the code
4. Think about time ..........................
From → technical life tips