__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 controlsor 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 阅读(19) 评论(0) 编辑 收藏

发表评论

昵称: [登录] [注册]

主页:

邮箱:(仅博主可见)

评论内容:

  登录  注册

[使用Ctrl+Enter键快速提交评论]

0 2190411 D9tHCzQ06MA=

导航

<2011年9月>
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

公告

昵称:smwikipedia
园龄:3年10个月
粉丝:13
关注:2

搜索

 

常用链接

我的标签

随笔分类(431)

随笔档案(344)

相册

最新评论

阅读排行榜

评论排行榜

推荐排行榜