First, let’s talk about how Asp.net works.
The specific description is as follows: First, the customer requests the WEB page. Then the WEB service looks for the instruction file (.aspx), and this is handled by the dynamic link library aspnet_isapi.dll. The Asp.net code is then sent to the common language runtime for compilation. The HTML stream is then returned to the browser and ordered. Finally, the browser processes the HTML and displays the page.
What is ISAPI?
At the beginning of the Internet era, clients had very limited needs; .htm files were all they needed. However, over time, client needs expanded beyond the functionality contained in .htm files or static files.
Developers need to expand or extend the functionality of the web server. Web server vendors have designed different solutions, but all follow the same theme of inserting certain components into the Web server. All Web server supplementary technologies allow developers to build and plug in components to enhance Web server functionality. Microsoft proposed ISAPI (Internet Server API), Netscape proposed NSAPI (Netscape Server API) and so on. ISAPI is an important technology that allows us to enhance the capabilities of ISAPI-compatible Web servers (IIS is an ISAPI-compatible Web server). We use the following components to achieve this:
1. ISAPI extension: ISAPI extension is implemented using Win32 dynamic link library. You can think of an ISAPI extension as a normal application. The processing target of ISAPI extension is http request.
2. ISAPI filter: Every time the client makes a request to the server, the request must go through the filter. The client does not need to specify a filter in the request, but simply sends the request to the web server, and the web server passes the request to the relevant filter. Next the filter may modify the request, perform some login operations, etc.
ASP.NET request processing process:
The ASP.NET request processing process is based on the pipeline model, in which ASP.NET passes http requests to all modules in the pipeline. Each module receives http requests and has full control. Modules can handle requests in any way they see fit. Once the request has passed through all HTTP modules, it is finally processed by the HTTP handler. The HTTP handler does some processing on the request and the result will again go through the HTTP module in the pipeline.
ISAPI filters:
IIS itself does not support dynamic pages, which means that it only supports the content of static HTML pages. For example, .asp, .aspx, .cgi, .php, etc., IIS will not process these tags, it will treat them as The composition text is sent to the client without any processing. In order to solve this problem. IIS has a mechanism called ISAPI filter, which is a standard component (COM component).
When the Asp.net service registers with IIS, it will register the file extensions that each extension can handle into IIS (such as: *.ascx, *.aspx, etc.). After the extension is started, it processes files that cannot be processed by IIS according to the defined method, and then jumps control to a process that specifically handles the code, allowing this process to start processing the code, generate standard HTML code, and put these codes after generation. Add it to the original Html, and finally return the complete Html to IIS, and then IIS sends the content to the client.