__VIEWSTATE
The value of this element is a base64-encoded string that acts as a state repository for the page. Any elements on a page whose contents are not implicitly posted back via the standard form POST mechanism have their values saved to and restored from this hidden field. It is also used to propagate supplemental state for controls梖or example, what prior value was stored in a control so that server-side change notifications can be issued. While the technique of propagating state using hidden input fields is common practice in Web applications, ASP.NET takes it a step further and uses it to unify the server-side control model by ensuring that all elements marked with runat=server retain their state across post-backs.
VIEWSTATE就是发送到client端的当前页面的状态, 但貌似只有在代码中赋予的值(方式2)才会在GET请求时被包含在VIEWSTATE中, 而对于页面中直接指定的值(方式1), 在GET请求中不会被包含在VIEWSTATE中.
方式1:
编译出来的代码为:
方式2:
编译出来的代码为:
posted on 2011-09-25 19:47 smwikipedia 阅读(193) 评论(0) 编辑 收藏 举报