2

According to the MSDN documentation, ScriptManager.GetStateString() "Retrieves a string that contains key/value pairs that represent the state of the Web page."

When I call the method it returns what appears to be a hashed string - how do I parse this into something useful? What exactly is returned by the GetStateString method?

EDIT: I notice that if I submit the form on the page or append data to the querystring, the value returned by GetStateString does not change. "Page state" apparently doesn't include this sort of state data?

UPDATE: When I set ScriptManager.EnableSecureHistoryState = false the hashed value is replaced with an empty string. Apparently if EnableSecureHistoryState = true, the value returned by GetStateString is encrypted and hashed.

4

1 回答 1

1

GetStateString()从历史哈希返回状态。

历史哈希是您在 Ajax 应用程序中启用浏览器后退/前进按钮的答案。它会记录您的条目,以便您可以前后移动。

查看将数据添加到历史哈希的AddHistoryPoint方法,并查看此博客文章以了解示例用法。

您何时收到哈希响应的原因ScriptManager.EnableSecureHistoryState = true是因为历史状态哈希表为空,但不是 NULL。它是一个仍然可以序列化和加密的对象。

如果状态哈希为 NULL 或空,将返回一个空字符串,我怀疑这是您的情况。您尚未添加历史记录点。

于 2010-02-23T07:58:57.327 回答