Why does __VIEWSTATE hidden field gets rendered even when I have the EnableViewState set to false

别等时光非礼了梦想. 提交于 2019-11-29 06:57:38

The __VIEWSTATE field is also used to store control state, which is not optional. Furthermore, the information contained in the view state is used to validate the postback, if I'm not mistaken (and validation is enabled, which is the default). So as long as you have the form with runat="server", you'll have a viewstate field. However, you should notice a much smaller field size if you disable all viewstate.

Tip: In Asp.net, if you need to strip the __VIEWSTATE out entirely, override the Page.Render method, render the page into a string, and strip out the __VIEWSTATE text out of it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!