State Management in ASP.NET
- A new instance of the Web page class is created each time the page is posted to the server.
- In traditional Web programming, all information that is associated with the page, along with the controls on the page, would be lost with each roundtrip.
- The Microsoft ASP.NET framework includes several options to help you preserve data on both a per-page basis and an application-wide basis.
These options can be broadly divided into the following two categories,
- Client-Side State Management Options
- Server-Side State Management Options
Client-Side State Management
- Client-based options involve storing information either in the page or on the client computer.
- Some client-based state management options are,
- Hidden fields
- View state
- Cookies
- Query strings
Server-Side State Management
- There are situations where you need to store the state information on the server side.
- Server-side state management enables you to manage application-related and session-related information on the server.
- ASP.NET provides the following options to manage state at the server side:
- Application state
- Session state