I can build that Web site in five notes

OK, I barely remember "Name that tune", but I think the meme is widespread enough for even the average juvenile dev to know. (for those even younger than I can imagine: NTT was a gameshow where people did a "reverse auction" to select how many notes they needed before they could name a song. Guess right, and you win big -- like a couch or something).

Anyway, this thought went through my head as I was looking at the source for an anonymous Web site about TechEd sessions today. I noticed that the page was 161,000+ bytes. Yes. Over 150KB. 32KB of which were ViewState.

Let that sink in a little bit. How about this. That's just over 13 pages in Word (and about 30 pages using manuscript format if my memory serves). For a form with four fields.

When I was at a past job, I was a little frightened at some of the people asking me "Why do you have EnableViewState set to false on that control?" The number of people seemingly willing to blindly dump KB of essentially junk at their users is horrid. If you don't need that ViewState, for gosh sake, *Turn it off!* If I were a (heavens forfend) 56KB modem user, as many people still are, that would be awful. Well, don't take my word for it, here's part of the report from WebSiteOptimization.com:

Download Times*

Connection Rate Download Time
14.4K 162.16 seconds
28.8K 81.18 seconds
33.6K 69.61 seconds
56K 41.85 seconds
ISDN 128K 12.95 seconds
T1 1.44Mbps 1.31 seconds

What can you do to avoid this epidemic of morbidly obese Web pages? Well, to start, read Scott Mitchell's "Understanding ViewState". Or Dino's "The ASP.NET View State". Or Susan Warren's "Taking a bite out of ViewState". Then, try turning off ViewState on controls, especially Repeaters, DataGrids, DataViews and GridViews that are populated in Page_Load anyway. Your users will be happier, making your boss happier, making you get a huge bonus and company car.

Or maybe I'll just stop whinging at you.

Print | posted on Saturday, June 10, 2006 6:01 AM

Feedback

# re: I can build that Web site in five notes

left by Anonymous at 6/11/2006 7:41 AM Gravatar
Fortunately ASP.NET 2.0's Data Source controls make disabling view state much simpler, as the control bound to the Data Source control will automagically rebind to it on every postback if its view state is disabled.

But 32KB of view state? That's nothing, young man! Back in my day, we had pages with over 800 KILOBYTES of view state!
http://scottonwriting.net/sowblog/posts/1579.aspx

;-p

# re: I can build that Web site in five notes

left by Anonymous at 7/10/2006 8:29 PM Gravatar
Have you looked at this page's viewstate? :)

# re: I can build that Web site in five notes

left by kent at 7/11/2006 1:52 AM Gravatar
Wow! Duncan's here -- I exist!

Yeah, I've been thinking about replacing "this" for a while now. Just time, and Azeroth, and motivation sitting between that and me.
Comments have been closed on this topic.