Prashant Jadhav

Prashant Jadhav

  • NA
  • 38
  • 14.3k

Application life cycle

Jan 6 2015 10:03 AM
hello guys 
from last few days i am struggling to understand how exact application request is get processed in asp.net
so here i am going to tell you what exactly i understand or rather think the  possible way asp.net process request
 as we all can see whatever written msdn and its various blogs as follows 
 
 
When ASP.NET receives the first request for any resource in an application, a class named ApplicationManager creates an application domain. Application domains provide isolation between applications for global variables and allow each application to be unloaded separately. Within an application domain, an instance of the class named HostingEnvironment is created, which provides access to information about the application such as the name of the folder where the application is stored.
 
 
 
After the application domain has been created and the HostingEnvironment object instantiated, ASP.NET creates and initializes core objects such as HttpContext, HttpRequest, and HttpResponse. 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, including cookies and browser information. The HttpResponse object contains the response that is sent to the client, including all rendered output and cookies. 
 
After all core application objects have been initialized, the application is started by creating an instance of the HttpApplication class. If the application has a Global.asax file, ASP.NET instead creates an instance of the Global.asax class that is derived from the HttpApplication class and uses the derived class to represent the application.
 
 
 
 
now till here i understand what exactly happening first application domain is getting created  then HTTPruntime    thenthose core object which are 
specific to request
my confusion is about HttpApplication object since this object contain all those event which are suppose to be application event
 
 list of events in HttpApplication:
 
BEGIN_REQUEST
AUTHENTICATE_REQUEST
AUTHORIZE_REQUEST
RESOLVE_REQUEST_CACHE
MAP_REQUEST_HANDLER
ACQUIRE_REQUEST_STATE
PRE_EXECUTE_REQUEST_HANDLER
EXECUTE_REQUEST_HANDLER
RELEASE_REQUEST_STATE
UPDATE_REQUEST_CACHE
LOG_REQUEST
END_REQUEST 
 
but in msdn they have said that this object is get reused for other request now if this object is raising all this evets for every request does it mean that
application it self raising all those event which i supposed till now run only one time at very first request of application resources  i am not understanding that how application level events are getting called for every request and also i have read that HTTPApplication object is derived from global.asax which cantain Application_start,Application_End events which runs only one time at first request .
is it possible that HttpApplication is an object which gets its event list from something which reprensent application truely which might be a object at lower level which microsoft has not mentioned in their documents on their official sites or blogs i mean can i imagine HttpApplication object
which get its event list from that imaginary object and get application_star and Application_end handler for star and end event event of that lower object and run those event for every request and those global.asax handler for only one time.   
 
 
 

Answers (2)