What is View State?

View State is the method to preserve the Value of the Page and Controls between round trips. It is a Page-Level State Management technique. View State is turned on by default and normally serializes the data in every control on the page regardless of whether it is actually used during a post-back.

A web application is stateless. That means that a new instance of a page is created every time when we make a request to the server to get the page and after the round trip our page has been lost immediately

Features of View State

  • Retains the value of the Control after post-back without using a session.
  • Stores the value of Pages and Control Properties defined in the page.
  • Creates a custom View State Provider that lets you store View State Information in a SQL Server Database or in another data store.
    Advantages of View State
  • Easy to Implement.
  • No server resources are required: The View State is contained in a structure within the page load.
  • Enhanced security features: It can be encoded and compressed or Unicode implementation.