logo
logo
Sign in

How to Outsmart Your Peers on ASP.NET PAGE LIFE CYCLE

avatar
meenati biswal
How to Outsmart Your Peers on ASP.NET PAGE LIFE CYCLE

HTTP requests processed by IIS go through a series of states on the way to generating a response. Similarly, ASP.NET pages also go through a series of states. As with IIS, the runtime generates events at each state that you can register a handler for and take action on. This diagram of the standard synchronous page life cycle and associated events.

The HTTP request enters the page-processing pipeline at the top of the figure when IIS starts to execute the Page Handler. As the processing progresses, the runtime moves from one state to another, calling all registered event handlers as it goes. In the synchronous case, a single thread from the ASP.NET thread pool does all the processing for the page.
The Render phase is not an event. All pages and controls have a Render() method that’s responsible for generating the output that will be sent to the client.

For Init and Unload, the runtime fires the events for child controls before the parent, so the Page events fire last. For Load and PreRender, the runtime fires events in the parent followed by child events, so Page events fire first. The other events in the figure above, except for Control Events, only exist at the Page level, not in controls. The runtime treats master pages as child controls of the Page.

DataBind is an optional event that happens after PreRender either when you set a DataSourceID declaratively, or when you call DataBind(). Read  more dot net course

If you have code blocks in your markup (using <%= %>), the runtime executes that code during the Render phase. That’s why you can’t set control properties using code blocks; controls are instantiated, including setting their initial properties, at the beginning of the page life cycle, whereas Render happens at the end.

Instead of the usual serial and synchronous approach, it’s possible to configure a page to run asynchronously. For asynchronous pages, ASP.NET inserts a special “async point” into the page life cycle, after the PreRender event. One thread executes the part of the life cycle before the async point and starts the async requests. Then the same thread, or possibly a different one from the thread pool, execute the rest of the life cycle after the async point.

Get more knowledge about asp.net application to learn dot net training in Chennai

collect
0
avatar
meenati biswal
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more