开发者

ViewStateMode Disabled but still getting ViewState element

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 c开发者_开发技巧hange anything.


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜