Web Forms :: Validation Of Viewstate MAC Failed - How To Avoid This Error
Dec 9, 2010
I have an application that works fine, problem rise when a page is waiting for the user response for more than 20 min and then user click a link on the form. The application response with the following error -
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 read a few articles regarding setting the Pages tag in web.config and set the Pages tag to the following -
I know this is a very common problem and a quick search in google offers a lot of solutions. However I could only find one person that came across it in the same way I am and no-one answered their question.
The scenario which causes this is if the page has been left dormant for a period of time and then a button is pressed which runs some sort of command. This might be pressing the logout button or trying to submit a contact form after having walked away at some point and then returning and hitting Send.
I do not have posts or actions in my form, it looks like this: <form id="form1" runat="server">
I have also added the following line to my web.config: <pages enableEventValidation="false" iewStateEncryptionMode="Never">
I have simply created two aspx pages for testing purpose, Page1.aspx and Page2.aspx.
Page1.aspx code is as follows:
[Code]....
And Page2.aspx simply have this code:
[Code]....
Now,when i run Page1.aspx and press the button i am getting this error. Can anyone tell me why this error is occuring ?
ERROR:
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.Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
I am having a small problem with my links on the master page. I have inserted 5 link buttons on my masterpage. In every link, I have set the PostBackUrl to the corresponding page. In the link click event, I have also written the C# coding: Response.Redirect(). When I run the homepage (that is using the masterpage as a template) and click on one of the link, I get this error: Validation of viewstate MAC failed.....
I'm trying to figure out this error but I can't point out what's exactly causing this.Here is what's happening.User loggs in for a few hours and gets "Validation of viewstate MAC failed" Error after post back.I have set timeout in Web.config as follow.
I don't know what is causing this. The weird thing is, eventually, it goes away (as in, i get to see the web application form), BUT my web app does not work properly. I have image buttons that are not showing the image that I set at imageButton.ImageUrl. It works fine when I run it on my local machine (IIS), but when I try it on one of those free hosting sites, it will go as far as showing the interface (which has the image buttons), but when I click, it suppose to be set with an image.
btw, the first aspx page contains a ListView control, then after clicking on a button in that page, it goes to another page that contains a bunch of imagebuttons and an ajax timer control. I get the " Validation of viewstate MAC failed" error AFTER clicking on the button (in the ListView page).
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.
Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: 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.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
or:
2) Add the following section to the configuration file of your application:
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
"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 deploy a simple web app,that works fine on my local system, on a remote server. The webform consist of a Menu control and a Listview control. If I browse the page and then leave it for like 20 minutes untouched and then try to select an entry from the menu I am getting the following error -
Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; AskTB5.6) Timestamp: Wed, 28 Apr 2010 07:39:24 UTC
Message: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500 Line: 4723 Char: 21 Code: 0 URI: http://www.shoeslocation.com/ScriptResource.axd?d=w3IpLZb6A3e5QHkk7kOTg4vdE8qw_8oIJ-6Kv5NpYYlCqyodfByoMbMvCI7RsUpH3U_p3tMqnuLd_nCq_qPaX4weg2w6s1FlfA_eQbVY-nU1&t=55414254
Before that I used to get the following error -
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.So I added the following to the Pages tag in the web.config validateRequest="false" enableEventValidation="false" viewStateEncryptionMode ="Never"
if my website when session of user expire i get the following error.
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.
After this message is displayed , no pages is able to access ....
The error message is :
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
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.
Anyone has experence with "Validation of viewstate MAC failed" issue while using Google Chrome? We have a customer having specific issue with Chrome. It's the strangest thing. In IE and Firefox, the problem does not exist, but once Google Chrome is used instead, he gets the error.
*note, we already have <pages enableViewStateMac="false" enableEventValidation="false"/>
Has anyone encountered while using Context.RewriteUrl in global.asax causes this error: 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 ?
Here is the scenario, let's say I have a url
http://mysite.com/admin/login.aspx instead typing the whole url in address, user can type either http://mysite.com/admin/ or http://mysite.com/admin which all end up at http://mysite.com/admin/login.aspx. When a user type http://mysite.com/admin and entered correct login info, and press login button it gets the error above. How can I resolve this? Tried setting EnableValidateRequest to false and EnableViewstateMac to false also even I do not want to use this approach and still does not work.
I have just setup a new ASP.NET Web Forms Site cleared out the default contents and added a button and a click event. That's it. Yet trying to run the page I get the error in the subject.
Looking around the web and this forum I have tried numerous things, including setting the <pages> tag each of the following three ways (not at the same time of course), adding debug = true to various places, etc. but the error persists.
I have received an error "Validation of viewstate MAC failed".
I am hosting the web site on my own server, so there is nothing like a "Web Farm or cluster". Can you advise what could be the problem with this error.
I only get this error if the page is left inactive for more then 20 minutes and it throws the exception, so users have log-off and login to continue working fine.
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.
Description:
An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
i have these message in only one user of my web ASP.NET application.
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey & validation algorithm. AutoGenerate cannot be used in a cluster.
After changing the Master Page in ASP.NET MVC 1.0 application, I keep getting this familiar error when I try a postback without filling in the mandatory form elements which are validated by the server:
"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."
The new page refers to a lot of jQuery code with lightboxes, superfish etc. Could that be a problem while doing a postback?
If I revert back to the original master, the error disappears and I'm able to validate form fields. Both masters are located in the same path.
After a little debugging, I've realized that a directive in the master page:
<% Html.RenderAction("menu", "nav"); %>
is creating the problem. The directive asks the "menu" action of the controller "nav" to inject a partial view Menu.ascx. If I delete this line from the new master page, everything works OK. My app's left bar navigation relies on this directive to work properly. Is there any way I can get around this?
I am trying a MVC 2 application on my computer's IIS and when I go to a page that contains a form I get the following error:
-----------------------
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.
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: 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. ------------------------------
What is strange is that on the begining the form is ok but after a while I started to get this error.And why at the start everything was ok and after a while I started to get this error?
I have a search page and it works most of the time but every now and then when I enter another word to search again, I kept getting this error in the Firefox's Error Console:
Error: Sys.WebForms.PageRequestManagerServerErrorException: 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. Source File: http://www.MyComp.com criptResource.axd?d=zNx0Fk9xi1ETKBw_Fc9MJ3a9Kp9CNPrHQDabGthwzSh32Wkw_OzriOYrMMZHyFSHnzqpp01wziW_tN0f9jEcZnJcMuTjBAcDB3ptDE0FILLyGwC956G8jI5pQ19F3beEYg0dkW9A9W-jBl1ZBsRms11V-vdOFaHdfpkaWww0H0tuL7am4AbVTa36mnOyWkDq0&t=2610f696 Line: 1508
i have a webapplication hosted on web server. when i open page example login page , if i login after 2-3 mins or open any page after some time i face error, mentioned below. Server Error in '/' Application.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. URL...
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: 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.URL...
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
or:
2) Add the following section to the configuration file of your application:
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.