我的 VIEWSTATE 是否已加密?

发布于 2024-11-15 06:02:12 字数 846 浏览 4 评论 0 原文

我有点困惑。我尚未明确设置 Web.config ,因此 此 MSDN 页面 表示它应该默认为自动此 MSDN 页面 表示 Auto 应该如果控件通过调用 RegisterRequiresViewStateEncryption 方法请求加密,则会导致视图状态信息被加密。但是,我的控件都没有调用该方法。所以看起来我的视图状态实际上不应该被加密。

但是,当我将视图状态复制/粘贴到各种 在线 视图状态 解码器,我被告知视图状态序列化数据无效。那么,我的视图状态是否已加密?有什么明显的方法可以告诉吗?默认 ASP.net 行为是否已更改为默认对视图状态进行编码,除非禁用它?

I'm a little confused. I haven't explicitly set the Web.config <pages ViewStateEncryptionMode="Always" />, and so this MSDN page says that it should default to Auto. This MSDN page says that Auto should cause the viewstate information to be encrypted if a control requests encryption by calling the RegisterRequiresViewStateEncryption method. But, none of my controls call that method. So it looks like my viewstate should, in fact, not be encrypted.

However, when I copy/paste the viewstate into one of the various online viewstate decoders, I'm told that the viewstate serialized data is invalid. So, is my viewstate encrypted or not? Is there some obvious way to tell? Has the default ASP.net behaviour changed to encode the viewstate by defualt unless you disable it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

栀子花开つ 2024-11-22 06:02:12

如果将其设置为“Always”或“auto”,则所有控件状态都将被加密。所有调用RegisterRequiresViewStateEncryption视图状态的控件都将被加密,与“Auto”/“Always”无关。如果您的“自定义控件”需要加密,请调用此方法。

请参阅 MSDN

如果您正在开发处理潜在敏感信息的自定义控件,请调用 RegisterRequiresViewStateEncryption 方法向页面注册该控件并确保该控件的视图状态已加密。

整个页面状态将是
加密的,如果
ViewStateEncryptionMode 设置为自动
或始终。

If its set to Always or auto, all control state would be encrypted.All controls calling RegisterRequiresViewStateEncryption view state would be encrypted ir-respective of Auto/Always. If your 'custom control' needs encryption call this.

See this on MSDN

If you are developing a custom control that deals with potentially sensitive information, call the RegisterRequiresViewStateEncryption method to register the control with the page and ensure view state for the control is encrypted.

The entire page state will be
encrypted if the
ViewStateEncryptionMode is set to Auto
or Always.

聆听风音 2024-11-22 06:02:12

强制打开它,看看解码器是否会出现相同的错误。

强制关闭,看看现在是否可以解码。

我想这会给你你正在寻找的答案。

Force it on, see if you get the same error from a decoder.

Force it off, see if it now decodes.

I think that will give you the answer you're looking for.

霊感 2024-11-22 06:02:12

默认设置可以在 machine.config 中找到,它是所有 Web 应用程序的通用超级配置。使用您的 web.config 您可以覆盖它。您可以打开您的网站之一并查看内部。

在这里你可以找到machine.config:

%WinDir%\Microsoft.NET\Framework\<FrameworkVersion>\CONFIG

The default settings can be found on your machine.config, which is a general super config for all your web apps. with your web.config you can overwrite it. you can open one of your website and look inside.

Here you can find the machine.config:

%WinDir%\Microsoft.NET\Framework\<FrameworkVersion>\CONFIG
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文