Validation of ViewState Mac failed

This item was filled under [ Forums ]

If your page doesn’t load slowly and you are not on a web farm, this little tipp might help you. Most people suggest to add the following attributes to the Page directive:

 

<pages enableEventValidation=false viewStateEncryptionMode =Never

 

This is known to be a security risk and in my case it didn’t fix the problem.

I think I found another way to eliminate the Error, add this to your Button which triggers the Postback Event:

   23 PostBackUrl=”~/yoursite.aspx”

Just post it back to the same site explicitly and you should be fine.

Edit: Another discovery, you can use the maxPageSateFieldLength attribute of the Pages element in the web.config. That will split the viewstate across multiple hidden fields if the content length is larger than maxPageSateFieldLength.

Hope that helps!

Rate this topic:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Popularity: 877 views
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

2 Comments on “Validation of ViewState Mac failed”

  • Swetha
    21 April, 2009, 11:08

    I’m interested, how did setting the PostBackUrl change the page and get rid of the error?

    In my case it was hard to test as my problem was that the page was loading slowly, and the “__EVENTVALIDATION” section (at the bottom of the page) was not yet in the transmitted HTML so couldn’t be in the passed POST variables (as I understand it). Hmmm…

    Cheers,

    Swetha

  • Rajesh
    21 April, 2009, 11:49

    very..very…nice post. Thanks for needful post

Leave a Comment