Application State Management in ASP.NET:

When you build dynamic Applications you need information between client requests. But HTTP is stateless protocol which means you need to maintain state of the controls in some other way.
What is state management?

State management is a process by which you maintain state and information of page (include all controls) between multiple client requests.

There are two Types of state management in ASP.NET.

Those are
1. Client side state management.
2. Server side state management.

Client side state management:
Client side state management means to store the values at client side.
We can maintain state at client side through Query string, viewstate and cookies.

Query string: Query string is the data that is append to the end of the URL. Query strings provide a simple but limited way to maintain state information.

For example if you want to pass information from one page to another, such as passing a id number from one page to another page where it will be processed.

In order for query string values to be available during page processing, you must submit the page using an HTTP GET command. That is, you cannot take advantage of a query string if a page is processed in response to an HTTP POST command.

E.g. http://www.codedefiner.com/page.aspx?id=2

ViewState: The view state retains values of the controls between multiple requests for the same page.

In Asp.Net all server control values are encoded and stored in the viewstate variable called __VIEWSTAE before responding to the server request.

For all server controls in ASP.NET viewstate property set to True by default.

Even you can create viewstate variable by assigning the value to viewstate.
Viewstate(“id”)=1027
The view state is a key element of an ASP.NET page because it is the primary means to persist the state of the Web server controls. Whenever the page posts back, the state is restored, updated using the current form parameters, then used to run the postback event handler. Normally, the view state is a hashed string encoded as Base64 and stored in a hidden field called __VIEWSTATE.


Next >>

Recent Articles

CLR integartion in SQL Server
Create, Read and Write Files in .Net
Message Queue in .Net
Deploy Asp.Net Web Site
Queues in Vb.Net
If you have any queries or doubts post at Forum
Share on Facebook
Responses(post your response or comments below)
Name *

Email * (won't be published)

Response *