Server-Side State Management is different from Client-Side State Management but the operations and working is somewhat the same in functionality. In Server-Side State Management all the information is stored in the user memory. Due to this functionality there is more secure domains at the server side in comparison to Client-Side State Management.

There are two types of Server-Side State Management techniques, these are:

1) Session State

2) Application State

3) Caching

4) Profile Properties


Session state is used to store and retrieve information about the user as user navigates from one page to another page in ASP.Net web application.

ASP.Net maintains session information using the session identifier .

Session state is maintained per user basis in ASPNet runtime.

Session state is being maintained automatically by ASP.Net. A new session is started when a new user sends first request to the server. At that time session state is created and user can use it to store information and retrieve it while navigating to different web pages in ASP.Net web application.

//Storing informaton in session state
Session["username"] = "nitish";
//Retrieving information from session state
string str = Session["username"]; 





The Session_start event is raised every time a new user makes a request without a session ID, i.e., new browser accesses the application, then a session_start event raised.


he Session_End event is raised when session ends either because of a time out expiry or explicitly by using Session.Abandon(). The Session_End event is raised only in the case of In proc mode not in the state server and SQL Server modes.

There are four session storage mechanisms provided by ASP.NET, These are:

• In Proc mode

• State Server mode

• SQL Server mode

• Custom mode


Application State is used to store information which is shared among users of the ASP.Net web application.

Application state is stored in the memory of the windows process which is processing user requests on the web server.

Application state is stored in the memory of the windows process which is processing user requests on the web server.

In ASP.Net, application state is an instance of HttpApplicationState class and it exposes key-value pairs to store information. Its instance is automatically created when a first request is made to web application by any user and same state object is being shared across all subsequent users.

Application state can be used in similar manner as session state but it should be noted that many user might be accessing application state

//Stroing information in application state
lock (this)
       Application["username"] = "nitish";
//Retrieving value from application state
lock (this)
      string str = Application["username"].ToString();


There are three types of events in ASP.NET. Application event is written in a special file called Global.aspx. This file is not created by default, it is created explicitly by the developer in the root directory. An application can create more than one Global.aspx file but only the root one is read by ASP.NET.

Events are:

Application_start: The Application_Start event is raised when an app domain starts. When the first request is raised to an application then the Application_Start event is raised.

Application_End:The Application_End event is raised just before an application domain ends because of any reason, may IIS server restarting or making some changes in an application cycle.

Application_Error: Application error is raised when an un-handled exception occurs, and we can manage the exception in this event.

void Application_Start(object sender, EventArgs e)
    Application["Count"] = 0;


There are six level of state management.

1) Control level: In ASP.NET, by default controls provide state management automatically.

2) Variable or object level: In ASP.NET, member variables at page level are stateless and thus we need to maintain state explicitly.

3) Single or multiple page level: State management at single as well as multiple page level.

4) User level: State should be preserved as long as a user is running the application.

5) Application level: State available for complete application irrespective of the user.

6) Application to application level: State management between or among two or more applications.

Click hear for Caching And Profile Properties