CryptographicException: Padding is invalid and cannot be removed and Validation of viewstate MAC fai

Posted by Chris Marisic on Stack Overflow See other posts from Stack Overflow or by Chris Marisic
Published on 2009-11-30T17:38:43Z Indexed on 2010/03/31 4:33 UTC
Read the original article Hit count: 378

Monitoring my global exception logs this error seems to be impossible to remove no matter what I do, I thought I finally got rid of it but it's back again. You can see a strack trace of the error on a similar post here.

Notes about the environment:

IIS 6.0, .NET 3.5 SP1 single server ASP.NET application

Steps already taken:

  <system.web>
    <machineKey validationKey="big encryption key"
      decryptionKey="big decryption key"
      validation="SHA1" decryption="AES" />

In my Page Base for all of my pages

  protected override void OnInit(EventArgs e)
  {
    const string viewStateKey = "big key value";

    Page.ViewStateUserKey = viewStateKey;
  }

Also in the source of the page I can see that all of the ASP.NET generated hidden fields are correctly at the top of the page.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#