ASP.NET Page Life Cycle

This is a favourite interview question: “what are the sequence of events in the ASP.NET page life cycle?”

Short answer:

  • Init
  • Load
  • PreRender
  • Unload

Long answer:

  • PreInit
  • Init
  • InitComplete
  • PreLoad
  • Load
  • LoadComplete
  • PreRender
  • SaveStateComplete
  • Unload
  • Disposed

Short answer with explanation, i.e., what to do when:

  • Init – read or initialize control properties
  • Load – set properties in controls and establish database connections
  • PreRender – make final changes to the contents of the page or its controls
  • Unload – do final cleanup work, such as closing open files and database connections, or finishing up logging or other request-specific tasks

References

23 May 2008 | Software engineering, ASP.NET | Comments

Comments:

  1.  
  2.  
  3.