Asp.net page life cycle passes through some series of process during their life cycle. Following are the stages
Begin request
- This event will show that it’s a new request
- Object and variables are initialized in this stage
- This event is raised on every request
Authenticate request
- .net is ready to authenticate the user in this stage
- Authentication code are inserted here
- This request confirms the authentication
Authorize request
- net is ready to authorize the user in this stage
- Custom Authorization code can be done here
- This request confirms the authorization of the user
Resolve request cache
- Output cache directive is commonly used in asp.net for caching
- After authorize request is finished, authorize will calls the cache request to serve the request.
- During runtime asp.net can load data from cache if needed.
- Any type of cache activity code can be written here
Map request handler
- Checks the extension of the file
- Checks the handler of the request
Acquire request state
- Ready to acquire session state variables/information
Process request
- Logic execution is done at this stage
Init
- Control’s id is set at this stage
- Dynamically add controls at this stage
- Read control properties
Load
- Controls are fully loaded at this stage
- All the values are restored in this stage
- “Ispostback” is used to avoid unnecessary state change
Render
- Method of page and page objects
- Html changes can be mad lastly in this section
- This method generates client side html and scripts to display
Unload
- This is to clean up the code like closing connection, closing opened files
- Page objects are unloaded from the memory
Release request state
- Save or update session variables are done at this stage
Update request cache
- Update cache before end of the process
End request
- Last stage end of the request
Image shows the page life cycle of an event in GET and POST condition