You must Sign In to post a response.
  • Category: ASP.NET

    Viewstate mac failed error in asp.net

    How to resolve View state mac failed error while posting data to server.
    Please provide a solution.
    some times it works fine but other is giving the error
  • #768298
    Hi,

    There are few things you need to validate from your side.

    #1 Check in the Web.Config file whether the Viewstate is in false.

    <system.web>
    <pages enableViewStateMac="False" />
    </system.web>



    #2 if the above point is fine, then now check the machine config in the same file. It should have Decryption key


    <system.web>
    <machineKey
    validationKey="" decryptionKey="" validation="SHA1? decryption="AES" />
    </system.web>


    Kindly let us know if still issue exists after the correcting above points.

    Thanks,
    Mani

  • #768300
    You need to check both options
    [1] Either Disable ViewStateMac equal to false. For this issue
     <system.web>
    <pages enableViewStateMac="False" /></system.web>

    [2] Configure MachineKey in Web.config
    You can resolve View state mac failed error issue with add given code snippet in your web.config file under <system.web>
     <machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" validation="SHA1" decryption="Auto>

  • #768332
    Do you have many controls on asp.net ? this problem occur when there are number of controls exist on single aspx page it is unable to handle the issue. So 'Invalid view state' exception thrown by system
    To resolve this we need to put following tag in web.config

    <system.web>
    <pages enableViewStateMac="False" />
    </system.web>

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]


Sign In to post your comments