State Management in ASP.NET

In this article, we will understand state management in ASP.NET in detail.

What do you mean by Sate Management?

State Management is a process by which state and page information is maintained over multiple requests for same or different pages. As HTTP is a stateless protocol, server does not store any information once the

response is sent back to client based on his request. When user submits request again, the server treats it as a new user. This is called stateless model. This model was workable when static web sites were developed and hosted in the past. Now, with interactive web sites or dynamic web site, there is a need to preserve some information to identify user, interact with user again and again within same session and same application. This concept is known as Stateful protocol. The information can be related to user, data objects, web pages or server objects.

To support this kind of model, ASP.NET provides two types of State Management techniques, server side and client side as shown in Figure.

State Management in ASP.NET

Server Side State Management Options

ASP.NET provides facility to save information on server side as well as in client side. The following options are available in Server Side State Management.

Client Side State Management Options

The options available in client side state management help in storing information either in the page or at the client computer. No information is stored at server side. The followings options are used for client side state management.

The demonstrate the concept of view state option, consider an ASP.NET project haring one ben Each time a button is clicked, it displays the number of times the button is clicked.

This hidden field can be accessed in code behind file as given below. Dim st as String = Request QueryString("username")