Lecture 4
Lecture 4
NET Course
by T. Ala’a Khalid
1
Lecture 4
ViewState, Session State and
Application State
2
Lecture Objectives
Levels of ASP.Net web application events
Sending data from one web form to another
Difference between ViewState, Session
State and Application State
3
Levels of ASP.Net web application events
4
Sending data from one web form to another
5
Difference between ViewState, Session
State and Application State
ViewState
ViewState variables are used to preserve data across
page postbacks
By default, ViewState of one web form is not available
in another web form (available only in that web form)
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 if the
browser is closed
ViewState is used by all ASP.Net controls to retain
their state across postbacks
6
Difference between ViewState, Session
State and Application State
ViewState
7
Difference between ViewState, Session
State and Application State
Session State
What is a Session in a web application?
Session is a unique instance of the browser
A single user can have multiple sessions
by visiting the web application with multiple instances of
the browser running with a different session-id
8
Difference between ViewState, Session
State and Application State
Session State
Session State variables are stored on the web server
Session State variables are cleared, when the user
session times out. The default is 20 minutes. This is
configurable in web.config
9
Difference between ViewState, Session
State and Application State
Session State
10
Difference between ViewState, Session
State and Application State
Application State
Application State variables are available across all pages
and across all sessions
Application State variables are like Multi-User global data
All sessions can read and write Application State
variables
Application State variables are stored on the web server
Application State variables are cleared, when the process
hosting the application is restarted
11
Difference between ViewState, Session
State and Application State
Application State
12
Levels of a web application events
H.W
In a web application, events can occur at 3 levels
List the events of each level and their functionality
13