asp.net - viewStateEncryptionMode ="Always"未加密

标签 asp.net encryption iis-6 viewstate cassini

由于一些安全问题,我需要启用 View 状态加密。我关闭了 viewstate 和 viewstateMAC,但我需要加密包含在 __VIEWSTATE 表单参数中的“control state”字符串。

目前我的 web.config 看起来像:

    <pages enableViewState="false" enableViewStateMac="false">

当我设置以下内容时,在 cassini 中,我的 View 状态被加密:
    <pages enableViewState="false" enableViewStateMac="false" viewStateEncryptionMode="Always">

当我在 IIS 6 服务器上进行相同的更改时,没有任何 react 。

我看到应用程序域回收(事件:应用程序 '/LM/W3SVC/...' 位于为域 '...' 初始化的 'C:...' 中)。当我触摸 web.config 但我没有像 cassini 那样获得加密的 View 状态。我尝试过站点停止/启动、IIS 重置停止/启动、清除 ASP.NET 临时文件缓存。任何人都对需要做些什么来配置这个有什么建议吗?

最佳答案

我遇到了类似的问题,归结为如果您预编译站点,页面的 web.config 节点将被忽略。您必须在编译时设置这些设置才能使其正常工作。我知道这已经晚了一年,但我想如果其他人来这里寻找问题的解决方案,这可能是有用的信息。

关于这个的一点简介:http://blogs.msdn.com/b/asiatech/archive/2011/07/19/pages-settings-don-t-work-for-pre-compiled-asp-net-applications.aspx

  • (链接已死 - 博客指向此文档:ASP.NET Web Site Project Precompilation Overview)
  • My customer had a viewstate MAC validation problem. As a workaround, he wanted to disable the viewstate MAC validation before find out the final solution. However, he was still seeing the problems after added follow settings in the configuration files.

    Customer’s application is a pre-compiled ASP.Net application with updatable option disabled. Looking at the code generated by compiler with above settings, we found these settings are hard coded. So, this means simply add the above setting into web.config doesn’t affect a pre-compiled application. To make this taking affect, the application has to be re-compiled.

    [DebuggerNonUserCode]

    private void __BuildControlTree(default_aspx __ctrl)

    {

    __ctrl.EnableViewStateMac = false;
    
    __ctrl.EnableEventValidation = false;
    

    __ctrl.ViewStateEncryptionMode = ViewStateEncryptionMode.Never;

    This is a by-design behavior.

  • 关于asp.net - viewStateEncryptionMode ="Always"未加密,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7162083/

    相关文章:

    asp.net - 无法为 .net 安装 "LemmatizerPrebuiltCompact"库 - Visual Studio 错误

    javascript - AngularJs:如何在不同域上设置相同的cookie

    python - 显示文件名,而不是文本小部件tkinter Python中的内容

    php - md5密码找回

    logging - 记录经典 ASP 表单帖子

    javascript - AngularJS 没有发生绑定(bind)

    javascript - RadAsyncUpload.click() 不起作用

    python - PyCrypto:生成受 DES3 密码保护的 RSA key

    performance - 监控 IIS 6.0

    php - 托管转移后 ExpressionEngine 无法正常运行