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.
This blog provided detailed explanation and resolutions for this error. Please have a check.
Mamba Dai,
Do you really believe that this blog explains how to solve this problem? If this blog is right, the conclusion would be that ASP.NET has a bug for many, many years, and that you need a workaround to fix it.
I don't believe that is true. I belive the problem is that the viewstate is encrypted using a machine key. If you didn't specify one., ASP.NET will generate one for you, but when the application pool recycles ASP.NET will generate a new one (especially in
shared hosted envoronments), but the viewstate cannot be decrypted using this new key, cuasing this error. Specifying a machinekey will solved this, because then on each end every request, the same key is used.
This will also solve unexpected redirects to the login page, because the authentication cookie is encrypted using the machine key. After I used a machine key in all of my projects, I never seen this error anymore....
If this blog is right, the conclusion would be that ASP.NET has a bug for many, many years, and that you need a workaround to fix it.
Please check this KB below which provides a fix for "Validation of viewfstate MAC Failed". Its title please view the below. Detailed information please go through this reference below.
FIX: Error message on an ASP.NET page after you submit a form that has the "action" attribute defined after you install the .NET Framework 2.0 SP2 or the .NET Framework 3.5 SP1: "Validation of viewstate MAC failed"
don't believe that is true. I belive the problem is that the viewstate is encrypted using a machine key.
If op is developing a application with web cluster or farm. The problem may result from the reason you mentioned.
I reproduced this error with submit button before. So the blog above may be a resolution for this question and there are other solved thread refer it as the asnwer:
Please check this KB below which provides a fix for "Validation of viewfstate MAC Failed". Its title please view the below. Detailed information please go through this reference below.
FIX: Error message on an ASP.NET page after you submit a form that has the "action" attribute defined after you install the .NET Framework 2.0 SP2 or the .NET Framework 3.5 SP1: "Validation of viewstate MAC failed"
That is great, but I'v seen this error also without setting the action attribute!
Mamba Dai - MSFT
If op is developing a application with web cluster or farm. The problem may result from the reason you mentioned.
I a web cluster or farm, this will happen for sure. The error explains why this happens. But as I explained, when between requests ASP.NET generate a different machine key, the same problem occurs on a single server. And although it is unclear to me why
ASP.NET sometimes generates a new key, especially in shared hosted environments, this happen, reslting in this error or an authentication cookie that is suddenly not valid anymore, redirecting the user to the login page.
If you would search in this forums, I suggested to specify the machine key in a single server environment many times, which solved the problems. And like I said, I never seen this error myself anymore, without using the hotfix or other option like setting
some properties in web.config to false, but by just adding a fixed machinekey.
If you would search in this forums, I suggested to specify the machine key in a single server environment many times
I did this before, but couldn't resolve this error I reproduced. (Not mean your answer is incorrect). Maybe there are differenct reasons result from this sort of error and there are different specified resolutions for it.
It's a meaningful discussion.
Hope this discussion can help others.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
ganapati.vvs
Member
81 Points
102 Posts
Asp.net site Error: "Validation of viewstate MAC failed."
May 13, 2012 07:53 AM|LINK
Hi all,
we have developed a site.
some times it gives some error.
the ERROR message is
Can any help me. Please....
nijhawan.sau...
All-Star
16460 Points
3178 Posts
Re: Asp.net site Error: "Validation of viewstate MAC failed."
May 13, 2012 09:02 AM|LINK
Have you deployed it on a web farm?
nijhawan.sau...
All-Star
16460 Points
3178 Posts
Re: Asp.net site Error: "Validation of viewstate MAC failed."
May 13, 2012 09:11 AM|LINK
Also try these solutions:
http://blogs.msdn.com/b/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx
Mamba Dai - ...
All-Star
23530 Points
2683 Posts
Microsoft
Re: Asp.net site Error: "Validation of viewstate MAC failed."
May 22, 2012 05:57 AM|LINK
Hi,
This blog provided detailed explanation and resolutions for this error. Please have a check.
Feedback to us
Develop and promote your apps in Windows Store
hans_v
All-Star
35998 Points
6551 Posts
Re: Asp.net site Error: "Validation of viewstate MAC failed."
May 22, 2012 08:40 AM|LINK
Mamba Dai,
Do you really believe that this blog explains how to solve this problem? If this blog is right, the conclusion would be that ASP.NET has a bug for many, many years, and that you need a workaround to fix it.
I don't believe that is true. I belive the problem is that the viewstate is encrypted using a machine key. If you didn't specify one., ASP.NET will generate one for you, but when the application pool recycles ASP.NET will generate a new one (especially in shared hosted envoronments), but the viewstate cannot be decrypted using this new key, cuasing this error. Specifying a machinekey will solved this, because then on each end every request, the same key is used.
http://www.developmentnow.com/articles/machinekey_generator.aspx
This will also solve unexpected redirects to the login page, because the authentication cookie is encrypted using the machine key. After I used a machine key in all of my projects, I never seen this error anymore....
Mamba Dai - ...
All-Star
23530 Points
2683 Posts
Microsoft
Re: Asp.net site Error: "Validation of viewstate MAC failed."
May 22, 2012 09:06 AM|LINK
Hi,
Please check this KB below which provides a fix for "Validation of viewfstate MAC Failed". Its title please view the below. Detailed information please go through this reference below.
FIX: Error message on an ASP.NET page after you submit a form that has the "action" attribute defined after you install the .NET Framework 2.0 SP2 or the .NET Framework 3.5 SP1: "Validation of viewstate MAC failed"
http://support.microsoft.com/kb/970459
If op is developing a application with web cluster or farm. The problem may result from the reason you mentioned.
I reproduced this error with submit button before. So the blog above may be a resolution for this question and there are other solved thread refer it as the asnwer:
http://social.msdn.microsoft.com/Forums/en-AU/vstswebtest/thread/cd9c5c03-4bf3-472b-814a-cd498b190c57
http://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/4225c965-7fd3-4557-b813-3623998c412f
Apologization is still required for my unspecific information and the KB provided above is better.
Feedback to us
Develop and promote your apps in Windows Store
hans_v
All-Star
35998 Points
6551 Posts
Re: Asp.net site Error: "Validation of viewstate MAC failed."
May 22, 2012 10:03 AM|LINK
That is great, but I'v seen this error also without setting the action attribute!
I a web cluster or farm, this will happen for sure. The error explains why this happens. But as I explained, when between requests ASP.NET generate a different machine key, the same problem occurs on a single server. And although it is unclear to me why ASP.NET sometimes generates a new key, especially in shared hosted environments, this happen, reslting in this error or an authentication cookie that is suddenly not valid anymore, redirecting the user to the login page.
If you would search in this forums, I suggested to specify the machine key in a single server environment many times, which solved the problems. And like I said, I never seen this error myself anymore, without using the hotfix or other option like setting some properties in web.config to false, but by just adding a fixed machinekey.
Mamba Dai - ...
All-Star
23530 Points
2683 Posts
Microsoft
Re: Asp.net site Error: "Validation of viewstate MAC failed."
May 22, 2012 10:26 AM|LINK
I did this before, but couldn't resolve this error I reproduced. (Not mean your answer is incorrect). Maybe there are differenct reasons result from this sort of error and there are different specified resolutions for it.
It's a meaningful discussion.
Hope this discussion can help others.
Feedback to us
Develop and promote your apps in Windows Store
geniusvishal
All-Star
15173 Points
2953 Posts
Re: Asp.net site Error: "Validation of viewstate MAC failed."
Feb 24, 2013 03:07 PM|LINK
Refer this article:
http://www.dotnetvishal.com/2012/10/andling-validation-of-viewstate-mac.html
My Website
www.dotnetvishal.com