Three solutions to ban ViewState

  • 2020-05-30 19:47:33
  • OfStack

There are three ways to disable ViewState for a control, a page, and the entire application.
1) control disabled: set the EnableViewState property of the control to false;
2) page disabled: add EnableViewState="false" in the Page instruction of the page;
3) application disabled: add program code to the Web.Config file

<pages enableViewState="false"/>
< /configuration>

You can also disable EnableViewState="false" in the page directive on the page
Sometimes we found that ViewState could not transfer the value normally, maybe it was disabled, it is ok to enable it again!

Related articles: