views:

59

answers:

1

I have a ASP.NET 4.0 webforms site where I have the MasterPage so it is set to ViewStateMode="Disabled" along with the content placeholders being set similarly.

When I'd view my page I'd still see a ViewState field rendered, I then tried adding the ViewStateMode="Disabled" to the page level also but that didn't change anything.

+2  A: 

I'm not aware of latest changes on ViewState for the framework 4 but you have to take into account that the ViewState field rendered to the client has 2 components: ViewState itself and ControlState.

The ControlState is ALWAYS sent to the client on the viewstate field no matter if you have enabled ViewState or not.

So you can expect to drastically reduce the size of the viewstate field sent to the client but not completely remove it.

Control state are the minimal things that a control need to persist across postbacks in order to work as expected.

Control State

In addition to view state, ASP.NET supports control state. The page uses control state to persist control information that must be retained between postbacks, even if view state is disabled for the page or for a control. Like view state, control state is stored in one or more hidden fields.

http://msdn.microsoft.com/en-us/library/bb386448.aspx

Claudio Redi
I didn't realize this was treated separately than viewstate.
Chris Marisic