Validation of viewstate MAC failed. effecting pages with asp data pager RRS feed

  • Question

  • User-600945157 posted


     I have a number of product pages which have a data pager control on them. An issue i have found is that if the user leaves the page static for a while (approx 5 minutes) and the comes back to the site then clicks either 'next' or 'previous' etc on the data pager control the following error occurs;

    "Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.”

    I have done some research into this and have been unable to find a solution, in my web config file i dont have a <machineKey>. The only part of the web config file which could possibly be causing the issue is;

    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />

     Does anyone have any suggestions on how to fix this issue? 

    Thanks, Martin

    Friday, May 15, 2015 5:59 AM


  • User475983607 posted

    There is a file named machine.config which contains setting for the entire machine.


    The machineKey is used to encrypt and decrypt ViewState. By default, the machineKey node is set to automatically generate a validationKey when an application starts or restarts.  If the server's machineKey is different than the machineKey used to encrypt ViewState, the server is unable to decrypt ViewState and you get the error described.

    The machineKey can be different for a several reasons. The web application is restarting within the 5 minutes. You're in a load balanced environment and the request whet to a different machine with a different machineKey.

    Please see the following MSDN article for more information.


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 15, 2015 7:07 AM