locked
Validation of viewstate MAC failed (ensure that <machineKey> configuration specifies the same validationKey) RRS feed

  • Question

  • User-1456397830 posted

    Hello!

    I receive this error when I try to upload an image using the "<asp:FileUpload id="FileUploadControl" control. I found the below code on the internet and paste that <machineKey> code to my web.config. I don't know if the validationKey must be any specific?

    I use: ASP.NET 4.0

    Website is hosted on a web server/farm

    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 put the below code in the web.config file but without any success. I wonder what causes this problem?

    <system.web>
        <machineKey decryption="AES"
    decryptionKey="F6722806843145965513817CEBDECBB1F94808E4A6C0B2F2,IsolateApps"
    validation="HMACSHA256"
    validationKey="C551753B0325187D1759B4FB055B44F7C5077B016C02AF674E8DE69351B69FEFD045A267308AA2DAB81B69919402D7886A6E986473EEEC9556A9003357F5ED45,IsolateApps" /> <pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode ="Never" maxPageStateFieldLength="5000"/>

    Wednesday, September 12, 2018 9:08 PM

Answers

  • User-1456397830 posted

    I found a solution by adding this line. Now it works:

    <pages enableViewStateMac="false" validateRequest="false" enableEventValidation="false" viewStateEncryptionMode ="Never"  maxPageStateFieldLength="5000"/>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 12, 2018 10:42 PM