• Home
  • Privacy Policy
  • Terms & Conditions
  • Contact
  • Advertise
Videos, Photos, Wallpapers, Free Download, Movies, Songs, Sports , Live TV, Entertainment
 
  • Home
  • Bollywood
  • Hollywood
  • Box Office
  • Beauty
  • Fashion
  • Celebrity
  • Business
    • Social Media
    • Money Online
    • Category
  • Entertainment
    • Bollywood
  • Video
    • Youtube
    • Video
  • Technology
    • Asp.net
    • C#
    • SQL
    • .Net
Showing posts with label architecture. Show all posts
Event sequences Processing Cycle of Requests from IIS to handler:
  • IIS gets the request
  • Looks up a script map extension and maps to aspnet_isapi.dll
  • Code hits the worker process (aspnet_wp.exe in IIS5 or w3wp.exe in IIS6)
  • .NET runtime is loaded
  • IsapiRuntime.ProcessRequest() called by non-managed code
  • IsapiWorkerRequest created once per request
  • HttpRuntime.ProcessRequest() called with Worker Request
  • HttpContext Object created by passing Worker Request as input
  • HttpApplication.GetApplicationInstance() called with Context to retrieve instance from pool
  • HttpApplication.Init() called to start pipeline event sequence and hook up modules and handlers
  • HttpApplicaton.ProcessRequest called to start processing
  • Pipeline events fire
  • Handlers are called and ProcessRequest method are fired
  • Control returns to pipeline and post request events fire
The Page Life Cycle Events

Page_Load : The Page_Load event is triggered. This method can be used to populate and bind data to your controls either from the database or any other sources, states, and so on.
The Page Life Cycle Events

Page_Render : The Render event is triggered, which creates the Response object for the web page. Now the page is eventually rendered through the Render event, which uses a text writer to write the response stream to the Response.
The Page Life Cycle Events

Page_UnLoad :
The page is unloaded from the memory, and the Response object is sent to the browser in the Page Unload event. You can override this method to perform your necessary cleanup activities. According to MSDN, “Unload is called after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and any cleanup is performed.”

The Page Life Cycle Events

Page_Init : The page life cycle starts with the invocation of the Page_Init event. This event is responsible for initializing the controls that you use in your page to their default values. This event can also be used to create or even re-create the controls in your web page that need to be created dynamically.
The sequence of events that are executed in the life cycle of a page.

The following are these events, listed in the order in which they are executed:

1. Page_Init
2. LoadViewState
3. LoadPostData
4. Page_Load
5. RaisePostDataChangedEvent
6. RaisePostBackEvent
7. Page_PreRender
8. SaveViewState
9. Page_Render
10. Page_UnLoad

These events can be overridden—that is, you can override them to implement your custom handlers—and are associated with their respective event handlers. The ASP.NET page life cycle events are discussed in the following steps:
  • The page life cycle starts with the invocation of the Page_Init event. This event is responsible for initializing the controls that you use in your page to their default values. This event can also be used to create or even re-create the controls in your web page that need to be created dynamically.
  • The next event handler that gets executed is the LoadViewState method that restores the View State for the web page. This method is only executed if and when the web page has been posted back and restores any previously stored View State data associated with the web page.
  • The next method to be executed in this chain of events is the LoadPostBackData. This method is responsible for processing the data of the server controls, and these controls are populated with the previously posted data.
  • The Page_Load event is triggered. This method can be used to populate and bind data to your controls either from the database or any other sources, states, and so on.
  • The RaisePostBackData and RaisePostBack events are triggered if, and only if, there was a postback. The PreRender event is fired next, and you can use this event to make any changes to the data contained in your controls prior to their rendering.
  • The Render event is triggered, which creates the Response object for the web page. Now the page is eventually rendered through the Render event, which uses a text writer to write the response stream to the Response.
  • The page is unloaded from the memory, and the Response object is sent to the browser in the Page Unload event. You can override this method to perform your necessary cleanup activities. According to MSDN, “Unload is called after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and any cleanup is performed.”
Application Life Cycle Events
  1. Whenever event occurs on the web page, the request is sent to the web browser; in our case, let the web server be IIS.
  2. The IIS picks up this request and looks for the server extensions. Each server extension is actually mapped to the IIS. Now, if the server extension of this request is .aspx, it maps to aspnet_isapi.dll. After this .dll is invoked, it hosts the ASP.NET worker process that initializes the Http Pipeline.
  3. If the HttpApplication object does not exist for the application, it creates one—or else it picks it from the pool of these HttpApplication objects and passes the incoming request to it to handle.
  4. The worker process calls the HttpRuntime.ProcessRequest() method.
  5. The HttpRuntime creates the HttpContext and calls the HttpApplicationFactory.
  6. The HttpApplicationFactory creates an instance of the web page object from a dynamically created assembly and selects the appropriate HttpApplication object that can serve the incoming request.
  7. The HttpApplication instance processes the request and, in turn, selects the appropriate PageHandlerFactory.
  8. The PageHandlerFactory now creates the page instance by making use of the page handler of the web page. It does this to return the page instance to the HttpRuntime through the HttpApplicationFactory.
  9. The HttpRuntime uses this page instance and calls the ProcessRequest() method of the web page.
  10. The ProcessRequest() method first calls the FrameworkInitialize() method and then calls the page life cycle methods.
We take a quick look at the ASP.NET architecture. We divide our discussion in two parts: the application life cycle events and the page life cycle events.

In the Http Pipeline, you have a set of objects, such as HttpRuntime, HttpWorkerRequest, HttpApplicationFactory, and so on.

The HttpApplicationFactory is simply a factory that creates HttpApplication objects. It is a pool that contains these HttpApplication objects so that the request can be served.

The HttpApplication object is responsible for selecting the appropriate PageHandlerFactory for that requesting page; this creates an instance of the page class of the web page that has initiated the request. All handler factories implement the IHttphandler interface. How does the HttpApplication object know which is the handler for that page? It first determines the type of the incoming request and invokes the appropriate handler factory.

If the request is for a page, then it calls the PageHandlerFactory for that page.

It finds the handler for the page by searching the section of the machine.config file. The HttpModule is one that fits into the HttpPipeLine of objects and can filter or edit the requests or the responses that come its way. On the other hand, the HttpHandler is responsible for initiating rendering and is defined in the configuration files. Your web page class actually derives from the System.Web.UI.Page class and implements the IHttpHandler interface.

Each page handler implements the IHttpHandler interface that contains the ProcessRequest() method, which is actually responsible for processing the request. The response is complete and served to the client browser after the page is unloaded from the memory.
The Application Life Cycle Events

1. Whenever you press the Submit button on the web page, the request is sent to the web browser; in our case, let the web server be IIS.

2. The IIS picks up this request and looks for the server extensions. Each server extension is actually mapped to the IIS. Now, if the server extension of this request is .aspx, it maps to aspnet_isapi.dll. After this .dll is invoked, it hosts the ASP.NET worker process that initializes the Http Pipeline.

3. If the HttpApplication object does not exist for the application, it creates one—or else it picks it from the pool of these HttpApplication objects and passes the incoming request to it to handle.

4. The worker process calls the HttpRuntime.ProcessRequest() method.

5. The HttpRuntime creates the HttpContext and calls the HttpApplicationFactory.

6. The HttpApplicationFactory creates an instance of the web page object from a dynamically created assembly and selects the appropriate HttpApplication object that can serve the incoming request.

7. The HttpApplication instance processes the request and, in turn, selects the appropriate PageHandlerFactory.

8. The PageHandlerFactory now creates the page instance by making use of the page handler of the web page. It does this to return the page instance to the HttpRuntime through the HttpApplicationFactory.

9. The HttpRuntime uses this page instance and calls the ProcessRequest() method of the web page.

10. The ProcessRequest() method first calls the FrameworkInitialize() method and then calls the page life cycle methods.
The sequence of events that are executed in the life cycle of a page.

The following are these events, listed in the order in which they are executed:

1. Page_Init
2. LoadViewState
3. LoadPostData
4. Page_Load
5. RaisePostDataChangedEvent
6. RaisePostBackEvent
7. Page_PreRender
8. SaveViewState
9. Page_Render
10. Page_UnLoad

These events can be overridden—that is, you can override them to implement your custom handlers—and are associated with their respective event handlers. The ASP.NET page life cycle events are discussed in the following steps:

1. The page life cycle starts with the invocation of the Page_Init event. This event is responsible for initializing the controls that you use in your page to their default values. This event can also be used to create or even re-create the controls in your web page that need to be created dynamically.

2. The next event handler that gets executed is the LoadViewState method that restores the View State for the web page. This method is only executed if and when the web page has been posted back and restores any previously stored View State data associated with the web page.

3. The next method to be executed in this chain of events is the LoadPostBackData. This method is responsible for processing the data of the server controls, and these controls are populated with the previously posted data.

4. The Page_Load event is triggered. This method can be used to populate and bind data to your controls either from the database or any other sources, states, and so on.

5. The RaisePostBackData and RaisePostBack events are triggered if, and only if, there was a postback. The PreRender event is fired next, and you can use this event to make any changes to the data contained in your controls prior to their rendering.

6. The Render event is triggered, which creates the Response object for the web page. Now the page is eventually rendered through the Render event, which uses a text writer to write the response stream to the Response.

7. The page is unloaded from the memory, and the Response object is sent to the browser in the Page Unload event. You can override this method to perform your necessary cleanup activities. According to MSDN, “Unload is called after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and any cleanup is performed.”
ASP.NET architecture. We divide our discussion in two parts: the application life cycle events and the page life cycle events.

The Application Life Cycle Events

1. Whenever you press the Submit button on the web page, the request is sent to the web browser; in our case, let the web server be IIS.

2. The IIS picks up this request and looks for the server extensions. Each server extension is actually mapped to the IIS. Now, if the server extension of this request is .aspx, it maps to aspnet_isapi.dll. After this .dll is invoked, it hosts the ASP.NET worker process that initializes the Http Pipeline.

3. If the HttpApplication object does not exist for the application, it creates one—or else it picks it from the pool of these HttpApplication objects and passes the incoming request to it to handle.

4. The worker process calls the HttpRuntime.ProcessRequest() method.

5. The HttpRuntime creates the HttpContext and calls the HttpApplicationFactory.

6. The HttpApplicationFactory creates an instance of the web page object from a dynamically created assembly and selects the appropriate HttpApplication object that can serve the incoming request.

7. The HttpApplication instance processes the request and, in turn, selects the appropriate PageHandlerFactory.

8. The PageHandlerFactory now creates the page instance by making use of the page handler of the web page. It does this to return the page instance to the HttpRuntime through the HttpApplicationFactory.

9. The HttpRuntime uses this page instance and calls the ProcessRequest() method of the web page.

10. The ProcessRequest() method first calls the FrameworkInitialize() method and then calls the page life cycle methods.

The sequence of events that are executed in the life cycle of an ASP.NET web page.

The Page Life Cycle Events

The sequence of events that are executed in the life cycle of a page.

The following are these events, listed in the order in which they are executed:

1. Page_Init
2. LoadViewState
3. LoadPostData
4. Page_Load
5. RaisePostDataChangedEvent
6. RaisePostBackEvent
7. Page_PreRender
8. SaveViewState
9. Page_Render
10. Page_UnLoad

These events can be overridden—that is, you can override them to implement your custom handlers—and are associated with their respective event handlers. The ASP.NET page life cycle events are discussed in the following steps:

1. The page life cycle starts with the invocation of the Page_Init event. This event is responsible for initializing the controls that you use in your page to their default values. This event can also be used to create or even re-create the controls in your web page that need to be created dynamically.

2. The next event handler that gets executed is the LoadViewState method that restores the View State for the web page. This method is only executed if and when the web page has been posted back and restores any previously stored View State data associated with the web page.

3. The next method to be executed in this chain of events is the LoadPostBackData. This method is responsible for processing the data of the server controls, and these controls are populated with the previously posted data.

4. The Page_Load event is triggered. This method can be used to populate and bind data to your controls either from the database or any other sources, states, and so on.

5. The RaisePostBackData and RaisePostBack events are triggered if, and only if, there was a postback. The PreRender event is fired next, and you can use this event to make any changes to the data contained in your controls prior to their rendering.

6. The Render event is triggered, which creates the Response object for the web page. Now the page is eventually rendered through the Render event, which uses a text writer to write the response stream to the Response.

7. The page is unloaded from the memory, and the Response object is sent to the browser in the Page Unload event. You can override this method to perform your necessary cleanup activities. According to MSDN, “Unload is called after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and any cleanup is performed.”
Older Posts Home

ASP.NET Examples

 
2012 24x7 Magazine. All rights reserved.
Designed by 24x7 Magazine