Learn how to a build a cloud-first strategyRegister Now


Error intermittently happening only in Production machine, working fine in DEV and Test

Posted on 2008-11-04
Medium Priority
Last Modified: 2013-12-17

I came across this exception. It is working fine on my DEV and Test environments but this exception seems to pop up a few times in PROD. It works fine if restarted again, it just keeps popping once in a while, when in PROD and the whole ap has to be restarted again because of it.

Has anyone come across this error? Any ideas to resolve this issue?


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.

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.

Source Error:

Stack Trace:

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.


<%@ Page Language="C#" Debug="true" %>


2) Add the following section to the configuration file of your application:



<compilation debug="true"/>



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.

[HttpException (0x80004005): Unable to validate data.]

System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int

System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +203

[ViewStateException: Invalid viewstate.

Client IP:

Port: 1257

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.432

ViewState: /wEPDwUKLTIyNjg4NDg5NA9kFgQCAw9kFgYCAQ9kFgICAw8PFgIeC05hdmlnYXRlVXJsBTpod

Referer: http://okcafsprd/Atlis/prj_menu.aspx?ProjID=106&Type=VA

Path: /Project/prj_menu.aspx]

[HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hoste

System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String

System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +282

System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serial

System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState

System.Web.UI.HiddenFieldPageStatePersister.Load() +198

System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83

System.Web.UI.Page.LoadAllState() +35

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean inclu

System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeSt

System.Web.UI.Page.ProcessRequest() +86

System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18

System.Web.UI.Page.ProcessRequest(HttpContext context) +49

ASP.prj_menu_aspx.ProcessRequest(HttpContext context) +4

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +3

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronousl
Question by:tejjas_dave
1 Comment
LVL 37

Accepted Solution

gregoryyoung earned 2000 total points
ID: 22882285
Your "prod" machine is a VM running some place? it seems that it got switched from one machine to another during your having an open request.

ASP.NET signs viewstate using some machine specific identifiers by default. If 1 machine signs view state then it is returned to another machine the second machine won't be able to deserialize the objects that are in view state and will give this error. You can specify a key to use in your web.config to override this behavior (what it is suggesting in the error).



Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

805 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question