views:

405

answers:

1

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?

+1  A: 

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.

Guffa
Yes which is why I asked for an optimal value that, I understand what it does. I've seen numbers as low as 40, 100 other instances of 1000, I haven't really seen any justification for any number as it seems like just arbitrary selections that aren't even powers of 2.
Chris Marisic
@Chris: The only reason that I see for using any other value than the default, is if you need to limit the size of the field values for some reason. If you have any need like that, the most optimal value would be the highest value that you can use.
Guffa
If I knew what that number was I wouldn't have posted this question. The reason this feature was added to ASP.NET back in 2.0 is that antiviruses/routers/proxies/etc can potentially truncate a single large hidden field which then correctly causes the pagestate to be invalid. Since this is a client issue that is not specifically reproducible is why I am seeking some type of consensus of what exactly is an optimal value for this that is not the default of -1.
Chris Marisic
@chris, this is the same question I want terribly to be answered. And I understand your frustration with the absence of such an answer. paging the experts...
nolisj