Scott Hanselman

ASP.NET ViewState = Appendix?

February 9, '04 Comments [3] Posted in ASP.NET | ViewState
Sponsored By

Last time I checked, ASP.NET ViewState wasn't an Appendix to be cut out.  The Flesk.ViewStateOptimizer makes this claim:

Reduces downloading time of your website or web application, by not sending back the page's Viewstate hidden field.

Oy! ViewState is one of the most useful and most maligned inventions of the .NET era.  Get to know it.  Turn it off selectively and when you know what you're doing. 

I'm going to go 'optimize' some nose hair now.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Monday, February 09, 2004 6:15:51 PM UTC
Doesn't look like they turn off view state ... instead they send a view state key instead of the state itself, storing the view state on the server for later retrieval. Interesting to do if bandwidth outranks other concerns for you. What am I missing?
phh
Monday, February 09, 2004 6:22:19 PM UTC
I'm kind of in the same boat at phh here... It sounds like view state is left on, but simply stored server-side.

I think it actually sounds kind of cool, but that's only because I wish I could (safely) have view state for password fields :)

Either way, whatever's going on here, thanks for the link. It's interesting at the very least...
Tuesday, February 10, 2004 5:23:46 PM UTC
Unfortunately, ViewState is abused. We were testing components when we discovered that some of them generated an absolutely atrocious amount of ViewState (and HTML too, but that's another issue). I mean, it's pretty bad when things are slow on localhost.

We do the same technique of stashing the ViewState off somewhere, and using a key to retrieve it. Quite frankly, I don't understand why Microsoft didn't do this. If you use session storage backed by a database, it even scales across server farms.
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.