Advantages and disadvantages of Viewstate

November 19, 2008 at 7:10 pm | Posted in ASP.NET | 6 Comments
Tags: , , ,

The primary advantages of the ViewState feature in ASP.NET are:

1. Simplicity. There is no need to write possibly complex code to store form data between page submissions.
2. Flexibility. It is possible to enable, configure, and disable ViewState on a control-by-control basis, choosing to persist the values of  some fields but not others.

There are, however a few disadvantages that are worth pointing out:

1. Does not track across pages. ViewState information does not automatically transfer from page to page. With the session approach, values can be stored in the session and accessed from other pages. This is not possible with ViewState, so storing data into the session must be done explicitly.

2. ViewState is not suitable for transferring data for back-end systems. That is, data still has to be transferred to the back end using some form of data object.

6 Comments »

RSS feed for comments on this post. TrackBack URI

  1. mrkuerlg

    mrkuerlg

  2. Good article 🙂

  3.  Good article, but need more details on viewstate like encryption,etc….

  4. Nice one

  5. Great article. Could you please explain view state life cycle in details?

  6. Website & articles are good.Why dont you update the website with more info?


Leave a comment


Entries and comments feeds.