Completely disable view state for web application

I noticed that even if I turn off the ViewState at the application level ( <pages enableViewState="false"/> ) or at the page level ( EnableViewState="false" in the page properties), you can still find a hidden field for viewing in the page sources :

  <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="NSe2ZpTF4OoGVDqwwtGVO+/liqfw9gUFmsPSD0n169Su3I6VwhG8xgVaSe0iTUfiPp1x0FbW9q47hkfxgDCvxjd2Z9RKo7N+WljNcEezg4Q=" /> 

Why does it still exist in this case? What does ASP.net store in it?

+4
source share
1 answer

Note that with Asp.Net 2.0, the __VIEWSTATE hidden field not only saves the ViewState , but also the ControlState .

The control state is similar, but independent of the normal state of the view. The control state cannot be disabled, therefore, if any control that needs a control state is on your page, this will cause the __VIEWSTATE hidden field to __VIEWSTATE in the displayed markup.

For more information on management status, see this page on MSDN .

+3
source

Source: https://habr.com/ru/post/1489743/


All Articles