Overview of ASP. NET operating principles 1. Overview of ASP. NET operating principles

Source: Internet
Author: User
Overview of ASP. NET operating principles

1. Overview of ASP. NET operating principles

 

 

For example, after an http request is sent and received by the IIS server, IIS first loads the corresponding dll file for the requested page type, then, the request is sent to the module that can process the request. in NET, this module is called HttpHandler. Why can aspx files be processed by the server? That is because the default HttpHandler on the server is used to process aspx files, before IIS sends this request to a module that can process this request, it also needs to go through some httpmodules, which are default Modules of the system, in addition, different HttpModuls must be processed before the http request is sent to HttpHandler. This is like if we want to fly an international flight to a foreign country, before you actually get on the plane, the airport construction fee should be purchased, the identity should be verified through registration procedures, the luggage should be packed and checked, and the security inspection should be conducted. Now, the temperature and other inspections should be carried out, and a series of strict procedures should be adopted. What are the advantages of doing so? One is for some necessary processes, the other is for security, the third is to improve efficiency, and the fourth is for us to be able to control more links, that is, our control capability is enhanced. The above are all systems. How can we say that we can control http requests? Can we establish our own HttpModule and HttpHandler? The answer is yes. But we should not rush to do things first. Let's take a deeper look at the operating mechanism.

2. ASP. NET operating mechanism

 

 

The figure above allows us to see more clearly how an http Request is processed by the server. At the same time, we can see that the Request is in charge of all client inputs. The figure shows four possible routes for an http request.
(1) When you access this page for the first time, the request first goes through the processing of HttpModuls and HttpHandler, and in the processing of HttpHandler, the server will forward you to the page you actually want to access, and then find the class behind the page through the ASPX Engine, and instantiate it asTemporary objectIn this process, a series of events are triggered. Some of the events need to be processed by the method in the object. Then, the server will send the processed page to the Response object, then, the Response object sends the page (in fact, the HTML page) to the client. This is the first route;
(2) When you resubmit some information on this page and continue sending requests to the server, because the sessions between your servers have been established, the temporary object you are located has been created on the server, so you do not need to initialize the page. Therefore, the second route is based on HttpModuls and HttpHandler, and then directly interacts with the temporary object, finally, send the page back to the client;
(3) What is different from the second one is that when processing a request, if ASP Cache needs to be called, the temporary object will directly extract information from the ASP cache and return it;
(4) When you refresh the page, the server receives the request and finds that the request has been processed previously, the processing results are stored in the output cache managed by a default HttpModule. Then, we can extract information from the cache and return the results without re-processing them.

Related Article

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.