This article will give brief about application
life cycle for ASP.NET applications that are running in IIS 7 & IIS 6.
Step by
Step explanation:-
1.
Whenever the
user requests for a web page the request goes to IIS.
·
In Classic
mode in IIS 7.0 and in IIS 6.0, the ASP.NET request pipeline is separate
from the Web server pipeline. In above case there are two request processing pipelines.
o One pipeline is for native-code ISAPI filters
and extension components.
o The other pipeline is for managed-code
application components such as ASP.NET.
·
In IIS 7.0
Integrated mode, the ASP.NET runtime is integrated with the Web server so that
there is one unified request processing pipeline for all requests.
2. A.) For classic mode, IIS then
checks the ISAPI (Internet Server Application Programming
Interface) extension of the request to check how to process the request.
·
If the
request is for an .aspx page then the request will be redirected to the ASP.NET.
B.) In
Case of integrated mode in IIS 7.0, a unified pipeline handles all requests.
·
All requests
can be configured to take advantage of ASP.NET functionality, because that
functionality is encapsulated in managed-code modules that have access to the
request pipeline.
·
For example,
even though the .htm file-name extension is not explicitly mapped to ASP.NET, a
request for an HTML page still invokes ASP.NET modules.
3. When the ASP.NET engine receives the request it check whether an
Application Domain exist for this request to run. If yes, it will use that
application domain, if not it will create one and pass on the request to that
Application domain.
·
Application Domain: - Is mechanism/process to provides the isolation
levels between applications so that various website hosted in the same IISservers will not interfere
with each other. It is an instance of the ApplicationManager class.
·
During the
first request, top-level items in the application are compiled if required,
which includes application code in the App_Code folder.
4. After the application domain has been created
and the HostingEnvironment object has been instantiated, application
response objects such as HttpContext,
HttpRequest, and HttpResponse are created and initialized.
·
The HttpContext class contains objects that are specific to the
current application request, such as the HttpRequest and HttpResponse objects.
·
The HttpRequest object contains information about the current
request, which includes cookies and browser information.
·
The HttpResponse object contains the response that is sent to the client, which includes all the rendered output and cookies.
5. After all application objects have been initialized, the
application is started by creating an instance of the HttpApplication class.
·
This object
contains the methods and events that are common for the application (the
current application domain). If we have a global.asax file in our application, we can handle all the
events raised by this object and perform our application specific operations
·
The first
time that an ASP.NET page or process is requested in an application, a new
instance of the HttpApplication class is created. However, to maximize
performance, HttpApplication instances might be reused for multiple
requests.
6. Once the HTTPApplication object is done with the request initialization,
authentication and authorization events, it passes the request to the Page.
This is the point where we write most of our code. Page life cycle will start from here.
The following tasks are performed by the HttpApplication class while the request is being processed.
·
Validate the
request
·
Perform URL
mapping, if any URLs have been configured in the UrlMappingsSection section
of the Web.config file.
·
The following tasks/events are
performed by the HttpApplication class while the request is being processed. (Click here for detail of this events)
§ BeginRequest
§ AuthenticateRequest
§ PostAuthenticateRequest
§ AuthorizeRequest,
§ PostAuthorizeRequest,
§ ResolveRequestCache,
§ PostResolveRequestCache,
§ MapRequestHandler,
§ PostMapRequestHandler,
§ AcquireRequestState,
§ PostAcquireRequestState,
§ PreRequestHandlerExecute,
§ PostRequesHandlerExecute,
§ ReleaseRequestState,
§ PostReleaseRequestState,
§ UpdateRequestCache,
§ PostUpdateRequestCache,
§ LogRequest,
§ PostLogRequest,
§ EndRequest,
§ PreSendRequestHeaders,
§ PreSendRequestContent.
7. Once the page processing is done, the HTTPApplication will
execute the cleanup and end request and then the response will be sent to the
user
its very nice article ..about your life cycle application its well explanation .Given so much information in it. its very useful .perfect explanation about Dot net .Thanks for your valuable information.
ReplyDeletedot net training in chennai velachery |
dot net training institute in velachery