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

Posted on 2008-11-04
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

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



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
    This video discusses moving either the default database or any database to a new volume.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now