In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the request processing process of ASP.NET". In the daily operation, I believe that many people have doubts about the process of ASP.NET request processing. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how the request processing process of ASP.NET is". Next, please follow the editor to study!
Processing of ASP.NET request
The ASP.NET request processing is based on the pipeline model, in which ASP.NET passes the http request to all modules in the pipeline. Each module receives http requests and has full control. The module can process the request in any way it sees fit. Once the request has passed through all the HTTP modules, it is finally processed by the HTTP handler. The HTTP handler does some processing on the request, and the result goes through the HTTP module in the pipeline again:
Note that during the processing of a http request, only one HTTP handler can be called, but multiple HTTP modules can be called.
Http processor
HTTP handlers are .NET components that implement the System.Web.IHttpHandler interface. Any class that implements the IHttpHandler interface can be used to process HTTP requests for input. The HTTP handler is somewhat similar to the ISAPI extension. The difference between HTTP handlers and ISAPI extensions is that they can be called directly in URL using the file names of HTTP handlers, similar to ISAPI extensions.
The HTTP handler implements the following methods:
The method name describes ProcessRequest, which is actually the core of the http processor. We call this method to process the http request. IsReusable We call this property to determine whether an instance of the http handler can be used to handle the same other types of requests. HTTP handlers can return true or false to indicate whether they can be reused.
You can use web.config or machine.config files to map these classes to http requests. After the mapping is complete, ASP.NET instantiates the http handler when the corresponding request is received. We will explain how to define all of these details in the web.config and / or machine.config files.
ASP.NET also supports extensions to http handlers through the IHttpHandlerFactory interface. ASP.NET provides the ability to route http requests to objects of classes that implement the IHttpHandlerFactory interface. In addition, ASP.NET takes advantage of the Factory design pattern. This pattern provides an interface for creating a set of related objects without providing the functionality of a specific class. In a nutshell, you can think of the class of the http handler object that is used to build the parameters passed in as a factory. We do not have to specify a specific http handler that needs to be instantiated; the http handler factory handles this transaction. The advantage of this is that if the implementation of the object that implements the IHttpHandler interface changes in the future, as long as the interface remains the same, the client will not be affected.
The following is a list of methods in the IHttpHandlerFactory interface:
Method name describes GetHandler this method is responsible for setting up the appropriate handler and returning its pointer to the calling code (ASP.NET runtime). The handler object returned by this method should implement the IHttpHandler interface. The ReleaseHandler method is responsible for releasing the http handler after the request processing is complete. The Factory implementation determines its operation. The Factory implementation can actually destroy the instance, or it can be placed in a buffer pool for later use.
Register the HTTP handler and HTTP handler factory in the configuration file
ASP.NET maintains its own configuration information in the following configuration file:
Machine.config
Web.config
The machine.config file contains configuration settings information that applies to all Web applications installed on your computer.
The web.config file is specific to each Web application. Each Web application has its own web.config file. Any subdirectory of the Web application may also contain its own web.config files; this allows them to override the setting information of the parent directory.
To add HTTP handlers to our Web application, you can use the < httpHandlers > and < add > nodes. In fact, handlers have < add > nodes, enumerated between < httpHandlers > and < / httpHandlers > nodes. Here is a common example of adding a HTTP handler:
< httpHandlers > < add verb= "supported http verbs" path= "path" type= "namespace.classname, assemblyname" / > < httpHandlers >
In the XML above
The Verb property specifies the HTTP actions supported by the handler. If a handler supports all HTTP actions, use "*", otherwise use a comma-separated list of supported actions. So if your processor only supports HTTP GET and POST, then the verb attribute should be "GET, POST".
The Path attribute specifies the path and file name (which can contain wildcards) where the handler needs to be called. For example, if you want your handler to be called only if the test.xyz file is requested, then the path attribute contains "test.xyz", and if you want all files with the .xyz suffix to call the handler, the path attribute should contain "* .xyz".
The Type attribute specifies the actual type of handler or handler factory in a combination of namespace, class name, and part name. The ASP.NET runtime first searches for the part DLL in the application's bin directory, and then searches in the global part buffer (GAC).
At this point, the study of "what is the request processing process of ASP.NET" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.