Validation of viewstate MAC failed

Posted by Elliott Nash | Filed under , , , , ,

I was simply attempting to post a form from one page to another when i encountered the following error:

HttpException (0x80004005): Validation of viewstate
MAC failed
. If this application is hosted by a Web
Farm or cluster, ensure that configuration
specifies the same validationKey and validation
algorithm. AutoGenerate cannot be used in a cluster.

It seems when developing with .NET 2.0 or later there is a bug in the framework which can become apparent if the following conditions are true:

  1. You are not using a web farm or cluster server environment.

  2. You are using built-in databound controls such as GridView, DetailsView or FormView which utilize “DataKeyNames”.

  3. I even encountered the error when posting to a new page with no code at all!

If these conditions are true and you click a postbacking control/link and the page hasn't loaded completely in client browser, you might get the "Validation of ViewState MAC failed" exception. When this happens, you have 2 choices to resolve the issue:

  1. You can just try setting the page property "EnableViewStateMac" to false this should alleviate the problem, although not ideal.

  2. It is RECOMMENDED to upgrade to .NET 3.5 SP1 (.NET 2.0 SP2) as it has a fix in it that should resolve this issue for good.

Viewstate MAC

The viewstate mac property indicates whether or not to verify message authentication codes (MAC) in the page's view state when the page is posted back from the client. Generally this property should be true when passing sensitive information between postbacks, or where there is a high risk of tampering. A view state MAC is an encoded version of the hidden variable that a page's view state is persisted to when sent to the browser. When you set the EnableViewStateMac attribute to true, the encoded and encrypted view state is checked to verify that it has not been tampered with on the client. The default value is false.

Comments

July 29, 2009 23:38

Patrick Huber

I'll just suggest to my web host that they update their servers.  Seriously, that just occured to me.  I'm sure that will go over well.

Patrick Huber United States

July 31, 2009 15:31

Ali

I was getting the same error, upgrading the .net 3.5 framework SP1 resolved the issue.

thanks


Ali

Ali Canada

November 10, 2009 07:06

Nosdo

This is a great article thanks for sharing this informative information.. I will visit your blog regularly for some latest post.

Nosdo United States

November 14, 2009 06:36

Happiness in Marriage is Entirely a Matter of Chance

I was actually looking around for a blog post on this issue, but stumbled across your site on Google! I’m actually quite interested so will keep an eye out for updates Smile

Happiness in Marriage is Entirely a Matter of Chance United States

November 29, 2009 19:50

fat burning furnace

I was actually looking around for a blog post on this issue. The Fat Burning Furnace System by Rob Poulos is a 158 page guide on how to lose fat and gain lean muscle in order to look better and also raise your RMR (resting metabolic rate).

fat burning furnace United States

December 2, 2009 22:00

waggi

Great post

waggi United States

December 2, 2009 22:02

takeshi006@yahoo.com

For me MAC is easy to used rather than using CSS because in CSS you need to be able to create new folder for inserting an image but in MAC you just can edit and put image directly to their server.

takeshi006@yahoo.com United States

December 24, 2009 11:59

fast payday loans

Like your writing! Still you can do some things to improve it.

fast payday loans United States

January 7, 2010 07:56

snoring cures

This is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free. It is the old what goes around comes around routine. Did you acquired lots of links and I see lots of trackbacks??

snoring cures United States

January 28, 2010 02:38

online payday loans

Small opportunities are often the beginning of great enterprises

online payday loans United States

February 5, 2010 06:14

fast advance

I like what I see. keep it going

fast advance United States

February 22, 2010 04:16

stock charts

Great Post, I love to read posts that are informative and beneficial in nature. Thank you for sharing your knowledge and I look forward to reading more.

stock charts United States

February 22, 2010 17:11

love calculator

Howdy, I was looking on the internet  and I found your site. Keep up the excellent work.

love calculator United States

February 23, 2010 16:59

background check

Hey everyone. Interesting topic for a blog. I have been searching the Internet for fun and came upon your website. Terrific post. Thanks a ton for sharing your experience! It is nice to see that some people still put in an effort into managing their websites. I'll be sure to check back again real soon.

background check United States

February 24, 2010 21:41

buy mailing lists

Always amaze in our technology ever since mac has exist. There products are pretty impressive.

buy mailing lists United States

February 25, 2010 10:22

Fatcow Review

I can't seem to find your rss feed, I would like to read more of your posts.

Fatcow Review United States

February 27, 2010 08:30

Stretch Mark Removal

Hi
I feel enjoy at your blog. Your article very helpful for me. Keep writing and happy blogging.

Thanks
Dave

Stretch Mark Removal People's Republic of China

February 27, 2010 12:33

Fatcow Review

Should I get a Dedicated Hosting? Right now I am using anhosting but they keep shutting me down because of high server load. Im getting about 2,000 UV a day. What brand should I get?

Fatcow Review United States

March 2, 2010 06:00

Domenic Moistner

Hi cheers for an incisive post, I really found your blog by mistake while looking on Goole for something else closely related, in any event before i ramble on too much i would just like to say how much I enjoyed your post, I have bookmarked your site and also taken your RSS feed, Once Again thanks for the blog post keep up the great work.

Domenic Moistner United States

March 2, 2010 10:50

Tran Wallen

Howdy that’s a very interesting view, It does give one food for thought, I am very delighted I stumbled on your blog, i was using Stumbleupon at the time, in any case i don’t want to drift on too much, but i would like to mention that I will be back when I have a little time to read your blog more thoroughly, Once again thanks a lot for the post and please do keep up the right work,

Tran Wallen United States

March 2, 2010 23:20

Tinisha Paling

This is a useful post, but I was wondering how do I suscribe to the RSS feed?

Tinisha Paling United States

March 4, 2010 23:24

jouer au poker en ligne

For some reason my browser doesn't display this page correctly... That said, it was a very interesting read, keep up the good work and I'll be back soon Smile

jouer au poker en ligne France

March 5, 2010 07:07

rapid mass traffic

Strangely the browser I got does not display that post as it should... Can you confirm that this article has been set up for Safari? Would be great if you could check it out, although it might come from a bug on my laptop

rapid mass traffic France

March 6, 2010 00:23

win my boyfriend back

I'm quite new to wordpress. but what you write in this post is really good and very informative. I think it will help me in the future. Thanks for the great job

win my boyfriend back United States

March 6, 2010 04:33

Ravichandran

I have installed .net framework 2.0 Sp2,
Then also i am getting same issues.
Please help me how i can resolve this?

Ravichandran India

March 6, 2010 04:48

Kimiko Jiminez

Thanks for sharing the link - but unfortunately it seems to be down? Does anybody have a mirror or another source?

Kimiko Jiminez United States

March 6, 2010 07:55

Fritz Sheive

Definitely agree with what you stated. Your explanation was certainly the easiest to understand. I tell you, I usually get irked when folks discuss issues that they plainly do not know about. You managed to hit the nail right on the head and explained out everything without complication. Maybe, people can take a signal. Will likely be back to get more. Thanks

Fritz Sheive United States

March 7, 2010 08:47

wedding on a budget

It's not that I have any intention to copy your blog, but I truly like the look. Could you tell me which template are you using? Or was it made especially for you?

wedding on a budget Slovenia

March 7, 2010 21:58

Hypno

Thank you in your can be helpful!

Hypno Germany

March 8, 2010 14:19

Andrew A. Sailer

hello good website yea nice job our blog review newspaper will soon be adding reviews on blogs and add them to our as the top best 100 websites to visit we also do reviews on  Customer Reviews  all types of product reviews visit us

Andrew A. Sailer United States

March 9, 2010 05:08

Noma Stelling

great post, are you a professional writer?

Noma Stelling United States

March 9, 2010 20:09

mortgage loan modification

Hi, Good content throughout the site. This page iswhere I got the most useful information for my research. Thanks for posting, maybe we can see more on this. I also like this layout can you tell me where to get it  

mortgage loan modification United States

March 10, 2010 11:49

online life insurance quotes 

You can probably edit that part if you are not sure the you can use filezilla,hope that works  out lol

online life insurance quotes  United States

March 10, 2010 16:52

Kartenlegen per mail

thanks for that info. I often read here...

Kartenlegen per mail Germany

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading