为什么__VIEWSTATE隐藏字段被渲染甚至当我将EnableViewState设置为false [英] Why does __VIEWSTATE hidden field gets rendered even when I have the EnableViewState set to false

查看:116
本文介绍了为什么__VIEWSTATE隐藏字段被渲染甚至当我将EnableViewState设置为false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了,即使我已设置的EnableViewState =假在页级__VIEWSTATE领域得到呈现。如果我删除=服务器标签的表单元素此字段不渲染。可有人请解释一下吗?

I saw that __VIEWSTATE field gets rendered even though I have set the EnableViewState="false" at the page level. This field is not rendered if I remove runat="server" tag for the form element. Can somebody please explain this?

推荐答案

该__VIEWSTATE字段还用来存储控制状态,这是不可选的。此外,包含在视图状态的信息被用于验证回发,如果我没有记错(并且启用了验证,这是默认设置)。所以只要你有=服务器的形式,你将有一个ViewState字段。但是,如果您禁用所有的视图状态,你应该注意到一个更小的字段大小。

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.

这篇关于为什么__VIEWSTATE隐藏字段被渲染甚至当我将EnableViewState设置为false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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