. NET ASP WebApplication Quick Start (4) (reprint)
Source: Internet
Author: User
application|web| Quick Start Application or session-scoped objects
In the Global.asax file, we can define static objects through the object tag, which
Like can be. NET Framework class, or it can be a classic COM component. Its scope can be
Any of a appinstance, session, or application. If an object's
The scope of action is appinstance, which means that the object clearly belongs to the HttpApplication
An instance, and is not shared.
Consider the following example of defining the scope of an object:
<object id= "id" runat= "server" class=. NET
Framework class Name "scope=" Appinstance >
What are httphandlers and factories (HTTP processors and factories)
Asp. NET provides a low level of request/response APIs that we can use to make
The. NET Framework classes are used to service incoming HTTP requests, which are httphandlers
and factories. HttpHandlers and factories can be said to be in the ASP.net framework of the
Axis. Factories (factory) assigns each request to a handler (processor), which is
This processor is responsible for processing the request again. The concrete implementation step is to create a support
System.Web.IHTTPHandler the class of the interface and executes the ProcessRequest () method.
Processors are often useful when the services that are extracted from the High-level page framework are not required to process HTTP requests
Way General uses of the processor include filters and CGI applications, especially those that return binary
Application of data.
Asp. NET receives a special class instance of each HTTP input request
IHttpHandler, IHttpHandlerFactory provides a processor to
IHttpHandler an instance of the underlying lower organization. Asp. NET with 3 standard
IHttpHandlerFactory class:
Pagehandlerfactory,restrictedresourcefactory and
Webservicehandlerfactory. We can also have the option to create and register additional
Factories (factory) to support richer requests for decision and activation of the occasion.
Configure httphandlers and Factories
HttpHandlers and factories are configured as part of the Config.web file.
Asp. NET defines a "httphandlers" configuration section where you can add and remove
HttpHandlers and factories. These configuration information can be inherited from subdirectories.
For example, the following code is located on the head of the Config.web file to map the
Request to the PageHandlerFactory class for the. aspx file:
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