I am building an application in ASP.NET 2.0 and the value for the view state is huge:
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTExNz...
The value contains 535,000 characters. Is this normal? How can I make it smaller?
ViewState can grow ugly on you. Basically I would say that the problem is that ViewState is enabled by default on everything, and a lot of things don't need it to be. The most basic example would be Label objects.
Try disabling ViewState where you find it unnecessary (EnableViewState is the property you're looking for).
Look into enabling ASP.NET tracing for your web pages - that will tell you what controls are storing how much in view state. You can then go and disable view state for controls that you know aren't using it.
If you write a bit of code, you can store view state in your server instead of sending it through the network for a round trip. Also you can compress it to save space/bandwidth and load time.
Here is something I wrote about it some time back.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With