View headers in asp.net

I keep hearing these words "Viewstate Chunking". What is Viewstate Chunking?

And how does it work for ASP.NET pages?

+11
viewstate page-lifecycle
May 02 '12 at
source share
2 answers

When the ViewState on your page becomes very large, this can be a problem, as some firewalls and proxies prevent access to pages containing huge ViewState sizes. For this purpose, ASP.NET introduces the ViewState Chunking engine. Thus, ASP.NET allows splitting one hidden ViewState field into several using the MaxPageStateFieldLength property in the web.config section.

If the MaxPageStateFieldLength property is set to a positive number, the view state sent to the client’s browser is broken into several hidden fields.

Setting the MaxPageStateFieldLength property to a negative number (default) means that the view state field should not be split into pieces. Setting MaxPageStateFieldLength to a small number may result in poor performance.

ViewState example before:

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"value="/wEPDwUKLTk2Njk3OTQxNg9kFgICAw9kFgICCQ88KwANAGQYAQUJR3Jp ZFZpZXcxD2dk4sjERFfnDXV/hMFGAL10HQUnZbk=" /> 

Then install in web.config:

 <pages maxPageStateFieldLength="40"> 

ViewState After example:

 <input type="hidden" name="__VIEWSTATEFIELDCOUNT" id="__VIEWSTATEFIELDCOUNT"value="3" /> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTk2Njk3OTQxNg9kFgICAw9kFgICCQ88" /> <input type="hidden" name="__VIEWSTATE1" id="__VIEWSTATE1" value="KwANAGQYAQUJR3JpZFZpZXcxD2dk4sjERFfnDXV/" /> <input type="hidden" name="__VIEWSTATE2" id="__VIEWSTATE2" value="hMFGAL10HQUnZbk=" /> 

Hope this helps you!

+16
Sep 05 '12 at 19:27
source share

From What's New in ASP.NET State Management - MSDN

If the amount of data in the view state becomes too large, the chunking view state automatically breaks the data into pieces and puts the data in several hidden form fields.

Why do we need Viewstate Chunking?

Here is an excerpt from ViewState Overivew - MSDN

Another important consideration is that if the amount of data in a hidden field becomes large, some proxies and firewalls access the page containing them. Since the maximum amount may vary depending on different firewalls and proxy implementations, large hidden fields can cause sporadic problems. To avoid this problem, the amount of data stored in the ViewState property exceeds the value specified on the MaxPageStateFieldLength property of the page, the page splits the view state into several hidden fields to reduce the size of each individual field below the size that firewalls reject.

+4
May 2 '12 at 12:43
source share



All Articles