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


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
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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).



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.