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.
In above exception viewstate is not getting validated/authenticated by the server. This happens when encryption key used for encrypting viewstate does not match on different servers in the web farm.
When we deploy an asp.net web application into a web farm environment, each web servers machine.config or web.config must specify the same key used for encrypting the view state. As view state is encrypted for security reasons and each machine.config on each web server will have a different key so they must all be the same. If they are different then viewstate created by one server will not be understood by other server and hence the above error.
Instead of editing machine.config file which may affect other applications running on the same server.
Best way is to add a machineKey element into each of the web server’s web.config and define the same keys and algorithm.
The machineKey goes under the System.web node. for e.g.
<machineKey validation=”SHA1″ validationKey=”A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4 E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1B2C3D4E5″
decryption=”Auto” decryptionKey=”A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1″ />
decryption=”Auto” decryptionKey=”A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1″ />
for machinekey setting parameters you can refer http://msdn.microsoft.com/en-us/library/w8h3skw9.aspx
There are few more reasons why this error may occure, Like while trouble shooting –
1. Please check Application Pool Recycling settings in the IIS, IIS keeps on recycling the application pool to maintain the applications health. During this recycling process requests from the client may get into invalid viewstate situation.The fix in this case is to adjust the settings on the application pools so that recycling is less likely to occur at peak periods
2. Any Antivirus software or firewall settings may diesect the viewstate, creating difficulty for sever to validate the viewstate.
3. Improper Form Posts- Viewstate can only be posted back to the same page. Attempting to post an aspx form to another page will fail with a viewstate invalid exception. This behavior is by design and obvious.
Some developers choose to disable the encryption of viewstate(ViewStateEncryptionMode =ViewStateEncryptionMode.Never) which is bad design, encryption is required so that no one should tamper the view state.
July 3, 2013 at 8:29 am
I like to disseminate knowledge that I’ve accrued with the yr to assist improve team performance.
July 7, 2013 at 3:18 pm
I always spent my half an hour to read this web site’s posts all the time along with a mug of coffee.
July 26, 2013 at 10:18 am
Good day! I just want to give a huge thumbs up for the nice information
you have here on this post. I will be coming again
to your blog for extra soon.
October 15, 2013 at 10:06 pm
Hey I know this is off topic but I was wondering if you knew of
any widgets I could add to my blog that automatically tweet my newest twitter updates.
I’ve been looking for a plug-in like this for quite some time and was hoping
maybe you would have some experience with something like this.
Please let me know if you run into anything. I truly enjoy reading
your blog and I look forward to your new updates.
October 17, 2013 at 2:59 pm
Thank you for any other informative site. Where else may I get that kind of
info written in such a perfect method? I’ve a undertaking that I’m simply
now working on, and I have been on the glance out for such information.
October 17, 2013 at 3:01 pm
Hi there, I enjoy reading through your post. I wanted to write a little comment to support you.
October 19, 2013 at 2:21 am
Having read this I thought it was rather informative.
I appreciate you spending some time and energy to put
this content together. I once again find myself spending a significant amount of time both reading and posting
comments. But so what, it was still worthwhile!
October 22, 2013 at 7:22 am
Hello every one, here every one is sharing such experience, therefore it’s nice to read this webpage, and I used to pay a quick visit this blog daily.
November 26, 2013 at 4:35 pm
I like your site the idea seemjs wonderful I really hope you keeep bringing up-to-date!
April 14, 2014 at 8:06 pm
Wow, superb blog format! How long have you been running a blog for?
you made blogging glance easy. The overall glance of your web site is fantastic, as
smartly as the content material!
June 23, 2014 at 9:54 am
This is very attention-grabbing, You are an excessively skilled blogger.
I’ve joined your feed and look ahead to looking
for extra of your fantastic post. Additionally, I’ve shared your
website in my social networks
June 26, 2014 at 11:03 pm
Thanks for some other wonderful article. Where else may just anyone get that kind of info in such an ideal method of writing?
I’ve a presentation subsequent week, and I am
at the search for such information.
July 12, 2014 at 12:01 am
whoah this weblog is great i like studying your posts.
Stay up the great work! You realize, a lot of individuals are
hunting round for this info, you could aid them
greatly.
August 4, 2014 at 9:44 pm
Wow, that’s what I was seeking for, what a material!
existing here at this web site, thanks admin of
this site.
September 15, 2014 at 11:51 pm
Simply wish to say your article is as astounding.
The clarity in your post is simply nice and i can assume you
are an expert on this subject. Well with your permission let me to grab your RSS feed to keep
up to date with forthcoming post. Thanks a million and please continue
the rewarding work.
September 18, 2014 at 4:07 pm
Thank you for sharing your thoughts. I really appreciate your efforts and I will be
waiting for your further write ups thank you once again.
October 27, 2014 at 10:09 am
great issues altogether, you simply received a new reader.
What would you recommend in regards to your submit
that you just made some days ago? Any certain?
November 2, 2014 at 1:46 am
Great post.
December 8, 2014 at 7:09 pm
Hi there, I want to subscribe for this web site to get hottest updates, so where can i do it please help.
March 12, 2015 at 9:33 pm
My family members always say that I am killing my time here at web, but I know I am
getting knowledge daily by reading thes good posts.
August 13, 2015 at 1:52 am
I seriously love you site.. Great colors & theme. Did you make this
website yourself? Please reply back as I’m wanting to create my
own blog and want to find out where you got this from or what the theme is called.
Thanks!