none
Validation of viewstate MAC failed RRS feed

  • Question

  • I am new to asp.net etc.

    I have developed a website that has began to act unusually. 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.

    Source Error:

     

    This error occurs when i navagate the website or log in and log out and seems to occur quite randomly - I dont think the remote server is a web farm.

    A similtaneous problem that may be related is as follows...

    During developement and running locally on my machine, pages appear not to fire the page load event, when navigated to via a masterpage treeview, these did previously and code fire in the load event that included the syntax "if page.ispostback = false"

    What I find strange about this problem is that when I load up previous versions of the website, from literally months ago the same problem persists (as though the problem is not with the website code)

    This is also true of the first problem - ie when I load up a previous version of the website the same error occurs.

    I have tried this

    <pages enableeventvalidation="false"
        viewstateencryptionmode="Never">   -didn't solve the problem

    I'am told I'm not on a web farm or cluster

    Can some one please help with this problem, Iam so close to finishing this project (although I have felt this for the past year!!)

    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:

    <configuration>
       <system.web>
           <compilation debug="true"/>
       </system.web>
    </configuration>

    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.

    Stack Trace:

    [HttpException (0x80004005): Unable to validate data.]
    
     System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +289
    
     System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +140
    
    
    
    [ViewStateException: Invalid viewstate. 
    
    	Client IP: 81.152.217.71
    
    	Port: 63728
    
    	User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET4.0C; .NET4.0E)
    
    	ViewState: /wEPDwUJNzEyMzM4ODA4D2QWAmYPZBYCAgMPZBYCAgUPPCsACQIADxYIHg1OZXZlckV4cGFuZGVkZB4LXyFEYXRhQm91bmRnHgxTZWxlY3RlZE5vZGUFEWN0bDAwX1RyZWVWaWV3MXQwHglMYXN0SW5kZXgCBWQIFCsAAgUDMDowFCsAAhYUHgVWYWx1ZQUESG9tZR4JRGF0YUJvdW5kZx4EVGV4dAUESG9tZR4LTmF2aWdhdGVVcmwFDS9EZWZhdWx0LmFzcHgeCFNlbGVjdGVkZx4JUG9wdWxhdGVkZx4IRXhwYW5kZWRnHgdUb29sVGlwBQpTdGFydCBQYWdlHghEYXRhUGF0aAUNL2RlZmF1bHQuYXNweB4QUG9wdWxhdGVPbkRlbWFuZGgUKwAFBQ8wOjAsMDoxLDA6MiwwOjMUKwACFg4fBgUJQ3VzdG9tZXJzHwQFCUN1c3RvbWVycx8HBSgvQWRtaW5pc3RyYXRpb24vQ3VzdG9tZXJzL0N1c3RvbWVycy5hc3B4HwsFDUN1c3RvbWVyIFBhZ2UfDAUoL2FkbWluaXN0cmF0aW9uL2N1c3RvbWVycy9jdXN0b21lcnMuYXNweB8FZx8NZ2QUKwACFg4fBgUIUGF5bWVudHMfBAUIUGF5bWVudHMfBwUmL0FkbWluaXN0cmF0aW9uL1BheW1lbnRzL1BheW1lbnRzLmFzcHgfCwUNUGF5bWVudHMgUGFnZR8MBSYvYWRtaW5pc...]
    
    
    
    [HttpException (0x80004005): 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.]
    
     System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106
    
     System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState) +14
    
     System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +242
    
     System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
    
     System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
    
     System.Web.UI.HiddenFieldPageStatePersister.Load() +207
    
     System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105
    
     System.Web.UI.Page.LoadAllState() +43
    
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
    
     System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
    
     System.Web.UI.Page.ProcessRequest() +80
    
     System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
    
     System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    
     ASP.default_aspx.ProcessRequest(HttpContext context) +4
    
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
    
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
    
    
    • Moved by edhickeyModerator Thursday, November 11, 2010 5:05 PM (From:.NET 3.0/3.5 Windows Workflow Foundation)
    Wednesday, November 10, 2010 9:13 PM

All replies

  • I have tried this

    <pages enableeventvalidation="false"
        viewstateencryptionmode="Never">   -didn't solve the problem

    I'am told I'm not on a web farm or cluster

    Thursday, November 11, 2010 10:27 AM
  • Hi,

    This Forum is for Windows Workflow issues, can you please ask this at http://forums.asp.net.

    Ed


    Ed Hickey http://blogs.msdn.com/b/edhickey/archive/2010/04/21/how-to-post-effectively-in-forums.aspx
    Thursday, November 11, 2010 5:04 PM
    Moderator