验证视图状态MAC失败

1

            //validationKey = CreateKey(20);

            //decryptionKey = CreateKey(24);

            byte[] bytes = new byte[len];

            new RNGCryptoServiceProvider().GetBytes(bytes);

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < bytes.Length; i++)
            {

                sb.Append(string.Format("{0:X2}", bytes[i]));

            }
            sb.ToString();
求2次值。

 

把值sb.ToString();放到webconfig里

<system.web>

  <machineKey validationKey="D7AE3806F70599FCD07EDEE09C8AEFD337414FE2"

decryptionKey="31F6CA4CA0517794D78DF0BCD57DBE9CEA5EA80A1FB2BFED" decryption="3DES" validation="SHA1"/>
</system.web>

2 在当前页面的<page ...>里加两个属性:
enableEventValidation="false" viewStateEncryptionMode ="Never"

博客园大道至简

http://www.cnblogs.com/jams742003/

转载请注明:博客园

上一篇:《BackboneJS框架的技巧及模式》(4)完结篇


下一篇:catalina.out日志切割脚本