MCTS 70-515 培训套件,视图状态错误?
本书第 123 页 - 第 3 章第 2 课中写道: ” Page.ViewState 属性提供了一个字典对象,用于保留之间的值 对同一页面的多个请求。该对象的类型为 StateBag。当 ASP.NET 处理页面时,页面及其控件的当前状态被散列成字符串,并且 作为名为 __ViewState 的 HTML 隐藏字段保存在页面中。如果数据对于a来说太长 单个字段(在 Page.MaxPageStateFieldLength 属性中指定),ASP.NET 执行 视图状态分块以将其拆分为多个隐藏字段。”
我对 __ViewState 隐藏字段的理解是,它存储与设计时相比发生变化的控件值。更不用说如果 __ViewState 是任意数量的哈希值由于哈希值的大小是固定的,数据永远不会变得太大。
这本书是错误的还是我在这里遗漏了一些东西......
On page 123 of the book - chapter 3, lesson 2. it says:
"
The Page.ViewState property provides a dictionary object for retaining values between
multiple requests for the same page. This object is of the type StateBag. When an ASP.NET
page is processed, the current state of the page and its controls is hashed into a string and
saved in the page as an HTML hidden field called __ViewState. If the data is too long for a
single field (as specified in the Page.MaxPageStateFieldLength property), ASP.NET performs
view state chunking to split it across multiple hidden fields."
my understanding of the __ViewState hidden field is that it stores the values of controls changed when compared to what they were at design time. Not to mention that if __ViewState was a hash of any amount of data it would never get too large since hashes are fixed in size.
Is the book wrong? or am i missing something here...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Viewstate 采用 base-64 编码。
这本书具有误导性,因为散列是单向操作,并且稍后在服务器端对其进行解码几乎是不可能的。
您的理解也是错误的,视图状态不存储与设计时值不同的值。基本上,它是在回发之间持久保存表单数据。请参阅 msdn (http://msdn.microsoft.com/en-us/library/bb386448.aspx) 了解详细信息。
Viewstate is encoded with base-64.
Book is misleading because hashing is one-way operation and it would make pretty impossible to decode it later on the server side.
Your understanding is also wrong, viewstate is not storing values different from design-time values. Basically, it is persisting form data between postbacks. Please refer to msdn (http://msdn.microsoft.com/en-us/library/bb386448.aspx) for detailed info.
我也在使用同一本书准备这次考试。该特定行似乎与下一篇文章中的信息相似
然而,如果您在 MSDN 的其他地方进行挖掘,就会得到以下准确的解释。
那么,来回答你的问题。
I am also studying for this exam using the same book. That particular line seems similar to the information in the following article
However, if you dig elsewhere on MSDN, one gets following explanation which is accurate.
So, to answer your questions.