不能关闭的ViewState(asp.net/VS2010),什么可能是错的? [英] can't turn off ViewState (asp.net/VS2010), what can be wrong?

查看:215
本文介绍了不能关闭的ViewState(asp.net/VS2010),什么可能是错的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从一个数据库生成的客户列表的应用程序。我有Default.aspx中禁用ViewState中,但现在当我看到生成的HTML页面的源$ C ​​$ C我看到的ViewState上。

I'm working on an application which generates a list of customers from a db. I have disabled ViewState in default.aspx, but now when I viewed the source code of the generated HTML page I saw that the ViewState is on.

我试过没有任何运气同时添加ViewStateMode =Disabled并的EnableViewState =假(另案甚至在一起)。

I've tried to add both ViewStateMode="Disabled" and EnableViewState="False" (separately and even together) without any luck.

什么可能是错的?

从源头code的ViewState code,如果有帮助:

ViewState code from the source code if it helps:

<div class="aspNetHidden"> 
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /> 
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /> 
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="88luWaDvrTt0+OWLhB and a lots of characters after this...

编辑:现在,当我在源$ C ​​$ C又看了看我可以看到,我觉得奇怪以下内容:

Now when I looked again in the source code I can see the following which I find strange:


  • 还有的ViewState的字符(需要15-20秒,通过它来滚动)
  • 系统LOT
  • 有与ViewState的code两地,彼此
  • 独立
  • There's A LOT of ViewState characters (takes 15-20 seconds to scroll through it)
  • There's two places with ViewState code, separate from each other

推荐答案

ASP.Net页面兼得的控制状态和视图状态。控制状态是绝对关键的数据,控制离不开功能(至少在理论上)。

ASP.Net pages have both Control State and View State. Control State is for absolutely critical data that the control can't function without (at least in theory).

查看状态和控制状态都存储在同一个领域。与视图状态站点完全禁用仍可能控制状态。

View State and Control State are both stored in the same field. A site with View State completely disabled may still have Control State.

不幸的是,ASP.Net是因为它在两者之间如何区分颇不一致。例如,的DropDownList 将与视图状态不再火更改事件禁用。我认为这是一个下降的一个重要功能下来,我会很乐意花的空间几个字节来存储控制状态当前选择的值,这样的改变可以被检测到。

Unfortunately, ASP.Net is quite inconsistent as to how it differentiates between the two. For example, a DropDownList will no longer fire change events with View State disabled. I consider that a critical function of a drop down and I would be happy to spend the few bytes of space to store the currently selected value in Control State so that a change could be detected.

如果你想知道的隐藏字段包含状态的内容,你可以的德code将其的。它可以用于检测视图状态泄漏非常有用。

If you are wondering about the contents of the hidden field containing state, you can decode it. It can be very useful for detecting View State "leaks".

这篇关于不能关闭的ViewState(asp.net/VS2010),什么可能是错的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆