Why State Management needed?

The reason behind this question lies in HTTP ┬áprotocol. Strange but it’s true.

HTTP is a stateless protocol. Each request is serviced as it comes; after the request is processed, all of the data is discarded. No state is maintained across requests even from the same client. This would typically mean that all information associated with the page and the controls on the page would be lost with each round trip. For example, if a user enters information into a text box, that information would be lost in the round trip from the browser or client device to the server. Thus, a new instance of the Web page class is created each time the page is posted to the server.

ASP.NET includes several options that help you preserve data on both a per-page basis and an application-wide basis:

  1. Viewstate
  2. Control state
  3. Hidden fields
  4. Cookies
  5. Query strings
  6. Application state
  7. Session state