如何禁用.aspx页的ViewState? [英] How to disable ViewState for a .aspx page?
问题描述
我需要为Web应用程序中的.aspx页面完全禁用ViewState.我浏览了不同的博客,但我了解到,我们必须设置<%@页面EnableViewState ="false" ...%>
,但这是行不通的.
I need to completely disable ViewState for a .aspx page inside my web application. I have gone through different blogs and what I understand is that we must set <%@ Page EnableViewState="false" ...%>
, but this is not working.
这足以禁用页面内所有控件的ViewState吗?还是我应该做其他修改?如果是这样,请指定它们.我不希望为.aspx页内的单个控件启用ViewState
Is this enough to disable ViewState for all the controls inside the page? Or should I make any additional modifications? If so, please specify them. I don't want the ViewState enabled for even a single control inside the .aspx page
推荐答案
我认为引号应为:
EnableViewState="false"
除此之外,如果您仍然看到隐藏的字段,则ASP.Net将使用它们.您可能会看到:
Apart from that, if you are still seeing the hidden fields then they are used by ASP.Net. You may see:
即使EnableViewState为false,页面也可能包含隐藏视图ASP.NET用于检测回发的状态字段.
Even if EnableViewState is false, the page might contain a hidden view state field that is used by ASP.NET to detect a postback.
这篇关于如何禁用.aspx页的ViewState?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!