views:

36

answers:

2

I know that the view state approach is limited to only a specific page. When we navigate to another page then information is lost. Other than this limitation are there any limitations with view state?

+1  A: 

I don't know if these are exactly "limitations", but they are certainly reasons you should avoid viewstate for certain things.

  1. All data in ViewState is uploaded and downloaded with every page request.
  2. Data in ViewState is not secure since it is available client side.
  3. All items in viewstate must be serializable.
  4. You cannot store server side resource in ViewState (think database connection, etc.) because each request the items are generated fresh (THEY ARE NOT THE SAME OBJECTS)

What are you trying to use ViewState for?

tster
it's not necessary that every time information is uploded and downloaded,we can off tracing view state at the end of int stage of page cycle.
Nishant
we can also secure data by configuring web.config file by writing encryption ="true"
Nishant
@Nishant, That's why I said "All data in ViewState is uploaded and downloaded with evey page request." If it isn't in ViewState, then it isn't in VIewState.
tster
it's not mandatery that all items shuold be serialized suppose i am sending data item of string type that time i need not to serialize it, but it's necessary for while we save object in view state
Nishant
ok thnks now i understand 2nd point ...thanks
Nishant
@Nishant, what makes you think strings are serialized? It's just that they are trivial to serialize.
tster
A: 

The only real limitation is that view state explodes the page size (up to many megabytes if not paid attention to). The more stuff you put into view state, the more convenient you do it for yourself, the less convenient it becomes for the users, especially those with dial-up connection.

There may be some networking issues if network components are configured to restrict submission size. I've heard something about proxy servers imposing limits on hidden fields (where the view state is stored).

Developer Art