Search This Blog

Thursday, December 4, 2008

ViewState Chunking in ASP.NET 2.0

.

When ViewState in your page become very large it can be a problem as some firewalls and proxies will prevent access to pages containing such huge ViewState sizes.

For this purpose ASP.NET 2.0 introduces the ViewState Chunking mechanism. But the first thing I would say is if your ViewState is that big ask yourself why, and the way to optimize (maybe disabling?) it.

So ASP.NET 2.0 enables to split the ViewState's single hidden field into several using the MaxPageStateFieldLength property in the web.config section. This indicates the maximum bytes size allowed for one viewstate hidden field. If the real size exceeds the value then viewstate is splitted in multiple fields.
By default, the attribute is set to -1 which means that no maximum size is defined.

Sample ViewState before: (click on below image to view it clearly )


Note : THIS IS NOT a way to optimize ViewState size!! This is a way to fix a possible technical problem with huge ViewState size and firewall.


Post a Comment

Popular Posts