Configuration :: Getting The ErrorValidation Of Viewstate MAC Failed?
Jul 14, 2010
I migrated my asp.net 1.1 project to 2.0 and made necessary changes.After publishing it sometimes i'm getting the errorValidation 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.Its totally random error and its very hard to regenerate it.Its sometimes faced by clients.Also I'm not able to find any solution for it any where.I added one line in web.config file as per suggested by some post under system.web section.
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.
Validation of viewstate MAC failed. If this application is hosted by a Web Form or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. How to solve this problem in web.config ....
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
Now here is the weird thing. First i am running it locally on the built in vs2008 web server.I load my control in fine, do a postback from a linkbutton, locally on my machine it all works fine, no issue.However when it goes onto my host, it falls over with the message:
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.Now i also load controls dynamically and use postbacks and things in the admin area of the site...and that works fine, however my front end just keeps failing? See the code behing below:
Yes, it's the infamous viewstate again! Now I am aware that problems can ocurr if you load controls in the wrong order or if the viewstate IDs are incorrect after postbacks etc etc. But my issue is that I am not really creating any controls dynamically - I only have one user control on the page.
More importantly, the issue seems to be occuring with just one user. What could be the problem? Corrupt browser cache?
ok - so I've narrowed it down a bit more. When I select an item from a drop down list control (which is a UserControl) - and then attempt to rebind my grid using the selected value, the error occurs.
The selectedvalue on postback seems to be zero every time (because the control is not in the viewstate somehow?!). The UserControl (containing the dropdownlist) is added at design-time.
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 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">
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 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
The entire message is Viewstate verification failed. Reason: Viewstate was invalid.
This is getting logged to the eventlog on our "dev" server. It suddenly started to happen. I have been programming locally and I am often (daily, hourly) moving new dll's and pages to the dev server so our BA can test. When my application gets an exception it puts up an error page and there's usually an event logged with "Error" severity - like if an index goes beyond array bounds, etc. The BA is getting the error page, but the message at the time is "Warning" severity and it's this viewstate thing. But the log is indicating it happened in my page. So I don't understand what I could've done to cause it.
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).
Sutring the website that im building, I opened up a page and left it open for about 40 minutes.
Next, i was trying to change selection in a DDL and got this error messag : Validation of viewstate MAC failed.
I read a bit abou the problem, still can't figure out why it happens, but it was written that a good workaround is :
[code]...
and third : I've thought about another solution. If the problem occurred while waiting, perhaps force refresh after certain amount of minutes of user doing nothing with the page. I think that I can perform the refresh using response.redirect, but what about the "WAITING "CERTAIN AMOUNT IF MINUTES OF USER DOING NOTHING WITH THE PAGE" part?
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 have a website(connect to active directory and pull the required details) deployed on the production web server and it is working fine from last one year.
But from last two days users are getting the following error frequently and find the error details below:-
how i can proceed on this error so that i will apply the fix in the webserver.
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.
My app is an ASP.NET 2.0 website. I use UpdatePanel to contain all UserControls. I also use ReportViewer control (local mode) for report function. When user click on "View Report" button, a javascript will be executed to open a new window which contains the ReportViewer control. Everything works well in my pc (Windows XP, IIS 5.1).
However, when I deploy the code to app server (Windows 2k3, IIS 6), I encounter a critical issue. After the report window is opened, whenever I click a button or change value of a DropDownList (UpdatePanel will be reloaded after these actions), an exception "Failed to load viewstate" is thrown.
I've tried to update the Report Viewer Redistributable 2005
(http://www.microsoft.com/downloads/en/details.aspx?FamilyID=e7d661ba-dc95-4eb3-8916-3e31340ddc2c) in the server to SP1 (assembly version: 8.0.50727.817),
If you open a web page on one of the websites hosted on our server, and leave it for 20 minutes, and then submit a form, a "Validation of viewstate MAC failed." error occurs.
In our control environment, we've started, somewhat intermittently, getting:
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.
on our website.It also suggests:
Source Error: The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please 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.
We already have compilation debug as true. We have upgraded our website to ASP.NET 4.0, although our middle tier components are still at 3.5. As we do in out production machine configs (which are using ASP.NET 3.5) we have
This control environment is not in a server farm. Why is it suggesting that I turn on debug, when it's already on. Why isn't it showing me my source code?
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.
my website was designed using dotnet 2003 worked under dotnet framework 1.0 the website was working fine then i had to upgrade the server to windows 2008 iis 7.0 so i configured the website to work under dotnet frame work 2.0 and the problem started to show up