Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is an optimal value for maxPageStateFieldLength in ASP.NET

In pages that have a viewstate that spans 10-15KB what would be an optimal value for

<pages maxPageStateFieldLength="">

in the web.config in order to reduce the risk of potential truncation leading to viewstate validation errors?

like image 783
Chris Marisic Avatar asked Apr 06 '10 13:04

Chris Marisic


1 Answers

The maxPageStateFieldLength doesn't limit the size of the view state, so it won't be truncated.

What it does is simply control how much of the view state will be placed in one hidden field. If the view state is larger than the maxPageStateFieldLength value the view state will simply be split into several hidden fields.

The default value is -1, meaning that the view state is put in a single hidden field, which is normally the most optimal.

like image 86
Guffa Avatar answered Oct 05 '22 23:10

Guffa