Events in Life Cycle of Web Application
In web application events can occur at 3 levels:
2 min readSep 28, 2020
Application Level
Page Level
Control Level
View State:
View State variables are used to preserve the data across page postback. But View state of one webform is not available in another web form.
Techniques to use data from one webform to another web form are as follows:
QueryString
Cookies
Session State
Application State
Session:
A session is a unique instance of a web browser. A single user can have multiple sessions, by visiting your application, with multiple instances of the browser running with a different session-id on the machine.
View State:
- ViewState of a webform is available only within that webform.
- ViewState is stored on the page in a hidden field called _ViewState. Because of this, the ViewState will be lost, if you navigate away from the page, or when the browser is closed.
- ViewState is used by all asp.net controls to retain their state across postback.
Session State:
- Session state variables are available across all pages, but only for a given single session. Session variables are like Single User — Global Data.
- Session state variables are stored on the web-server.
- Session state variables are cleared when the user session times out. The default is 20min. This is configurable in web.congif
Application State:
- Application State variables are available across all pages and across all sessions. Application State variables are like Multi User — Global Data.
- Application State variables are stored on the web-server.
3. Application State variables are cleared when the process hosting the application is restarted.