Determining the Order of ASP.NET MasterPage and Page Events

Anyone who is a regular ASP.NET developer is likely familiar with the ASP.NET Page LifeCycle diagram that Kris van der Mast posted on his blog more then 3 years ago. It is indisputably the best reference when trying to determine where to insert your code in the life cycle of your pages. There is however a lack of clarity on where MasterPages fit into the picture. With a bit of logging and digging, here’s a diagram which illustrates clearly in which order MasterPage and Page events are fired. If you’re deriving a custom MasterPage or Page class for your site, the diagram also shows the relation between your class code and the automatically attached MasterPage and Page events.


OrderOfASPNETMasterPageAndPageEvents

Leave a comment

Your email address will not be published. Required fields are marked *