Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

View State

I want to store an XML value using ViewState.

I wanted to know if there is a limitation to the size/length of the data that be stored thus.

Wednesday, January 19, 2005

Theoretically, I don't believe so - viewstate is basically a hidden form post, and it all gets transmitted to the client as data.

Practically, it's the equivalent of sending a lot of data to the client. It's going to slow down the page because you're sending a lot of data.

Wednesday, January 19, 2005

ViewState was the most brilliant, and most terribly implemented, idea in ASP.NET.

Using it for anything more than absolutely required is a HUGE mistake.

Brad Wilson (
Wednesday, January 19, 2005

It's worth thinking about deployment as well. For an intranet app you can get away with a lot more than a standard internet application.

Wednesday, January 19, 2005

I'm curious as to why you say that Brad.  Are you suggesting it could have been implemented better?  If so, how?

I agree, the flexibility is great, but also that it's gotten more people into more trouble than I can remember.  I just don't have an idea of how it could be fixed. :)

Some sort of bizarre javascript huffman coding?  (The worst offenders I've seen are scads of similar data repeated throughout viewstate when decoded from base-64.  I've seen > 400k viewstates... frequently.)

Pseudo Masochist
Wednesday, January 19, 2005

Our first attempt at solving this problem was storing the view state on the server, which helps tremendously. You can store it in some place that's reachable by all web servers if you're in a farm, such as shared session.

We later replaced view state with something we called page state & control state, which worked similarly (except more elegantly in our code) to store things on the server.

Brad Wilson (
Tuesday, January 25, 2005

*  Recent Topics

*  Fog Creek Home