In-depth analysis of ASP. NET architecture-ASP. NET Request Processing Process (1)

Source: Internet
Author: User

  Preface

Why should I write this series, because it is helpful for us to have a deeper understanding of certain problems only by understanding the operating mechanism, learning the underlying layer well?

  Reading directory

I. Working Principles of ASP. NET

 Ii. Execution Process of ASP. NET pages

Iii. ISAPI

Iv. Process of ASP. NET requests

  I. Working Principles of ASP. NET

The following figure shows how ASP. NET works?

1.1 customer request web page

We know ASP. NET is a B/S structure, that is, a structure such as a server and a browser. The server can have one or more servers, and there can be countless browsers. Each client accesses the server through a browser, therefore, the first step is to request a Web page.

1.2 Web server command file search

Therefore, this command is sent to the server through a browser, such. If the. Framework has been installed on the server, you can find this command.

1.3 ASP. NET code is compiled when it is sent to the Public language runtime.

Who will handle this command? It is handled by the dynamic link library aspnet_isapi.dll. all. NET. aspx files are all processed by aspnet_isapi.dll. Its function is. the aspx file is sent to the Public Language Runtime for compilation, that is,. framework.

1.4 HTML stream returned to the browser

After compilation, return the HTML stream to the browser.

1.5 The browser processes HTML streams and displays the page

The browser interprets the HTML stream and displays the page.

We can see that the processing process of the Web server is to call aspnet_isapi.dll to process the aspx file. The processing result is an HTML static page.

    Ii. Execution Process of ASP. NET pages

2.1 Each. aspx file actually inherits the page class. During the running process, it changes from a class to an object, which is an instantiation process.

2.2 After converting a class into an object, the CLR converts it to HTML and sends it to aspnet_isapi.dll.

2.3 aspnet_isapi.dll then interacts with IIS and sends HTML to IIS.

2.4 IIS returns HTML to the browser.

      

    Iii. ISAPI

We have talked about aspnet_isapi.dll several times before. What is aspnet_isapi.dll?

At the beginning of the Internet, Intent is basically a static page, and the static page is. HTML files are representative, but with the development of the demand, static pages cannot meet the demand. At this time, developers need to expand the functions of the Web server, at this time, different Web server vendors follow the same topic "insert certain components to Web servers", which greatly enriches Web servers, for Web servers, it can expand functions by adding components to call components to implement some functions. All Web servers allow developers to insert some components themselves to enhance the functions of the Web Server. Microsoft proposed ISAPI (the full name is the Intent Server API), so here I understand, provides a technology that allows developers to insert components into the Web server to expand the functions of the Web server.

ISAPI is an important technology that allows us to enhance the capabilities of Web servers compatible with ISAPI.

ISAPI is often implemented in two ways.

3.1 ISAPI extension

ISAPI extensions are implemented using Win32 Dynamic Link Libraries. We mentioned previously that aspnet_isapi.dll is implemented using dll.

3.2 ISAPI filter

Each time the client sends a request to the server, it must be filtered. The client does not need to specify a filter in the request, but only needs to send the request to the Web server. The Web server sends the request to the related filter, the filter may modify the request and perform some operations.

    Iv. Process of ASP. NET requests

ASP. the processing process of NET requests is based on the pipeline model. In the model, ASP.. NET sends HTTP requests to all modules in the pipeline. Each module receives HTTP requests and has full control over them. The module can process requests in a way that is deemed appropriate, once an HTTP request passes through all the HTTP modules and is finally processed by the HTTP handler, the HTTP handler team processes the request and the result passes through the HTTP module in the pipeline again. Similar to a pipe.

      

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.