ViewStateMode Disabled but still getting ViewState element

前端 未结 1 1315
野趣味
野趣味 2021-01-18 04:59

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 similarl

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-18 05:46

    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 contains the minimal things that a control needs 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

    0 讨论(0)
提交回复
热议问题