error message - Validation of viewstate MAC failed

Discussion in 'ASP.NET 2.0' started by Penobscot, Sep 15, 2006.

  1. Windows 2003 Server
    ASP.net 2.0 (Visual Basic)
    MS SQL 2005

    I use a shared hosting plan from Discount ASP.net . I am getting an error message. Do you have a solution that I could try?

    Description this error message:
    This is a data driven web site. A web page is open, but is not being used (nothing is clicked for about 20 minutes). Then, after 20 minutes (or more) I click something to change the data. Then I get this error. I refresh the page, but the error remains. Then I reload the page. Then page looks OK, but the data has not changed. Then I click to change the data and then the data is updated.

    Thanks



    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:

    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:

    [CryptographicException: Padding is invalid and cannot be removed.]
    System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast) +1488620
    System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) +306
    System.Security.Cryptography.CryptoStream.FlushFinalBlock() +30
    System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo) +154
    System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +152

    [ViewStateException: Invalid viewstate.
    Client IP: 69.34.205.237
    Port: 10973
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
    ViewState: rjI7BFgeBoWMfhEz5f7pPq26ZxlLELMRaYprYDxd7x9SCZDnZTEA1+C7ZfqWOgWAfQsk78jsIZbiH54hQPuAYMX0ZpwRQKXu28DX9XkQJ+6WCbRgzqVSiP4/wROybSraZdH+WubECnWDnivtQf71x1hOiDvtvfonpNSNgfIOOfa/0Im7+G8DPRIuKWXqx6VrsVTAx2XfezAVcUCbTLBH59QjAIDfrmwJx+fnlyng6ycbErmCyeaR1gS1g+l+d1nFSSSMG3y5NKVQ579R3I9yxohAHHGq4M9YkqtjWp0znM6rnfdtvQILh05NZ6du+FAxG3hfvb2hF3StXnMZ8iLR8/00aXOPJjnzCktzU2ykOdBSWFf67gJDwpQ/z9E8+QqJaelNxNN5ha12RuLWeYMi47p5lvAsC1X56+7hBiJeDwCY2fU4VMmxX1a2YJ0IfLNL8zTZQEpnFHyMbZbogIUwrhVuj5ukgbEoomuRNaWY4nBoNy3UaTiiwWGIgIJyUSXx+tyxjYL/hc2isC3+VFbVSr+WnQzJPrZJwFupsR/iteCyCkZJ5ZMbBDN8W05jc+sfe1s55oqutKo4+EBr9f3nT12hTECAQWz0NVimcTw6Uup/9aWHFGkP//yVE/L2IN6jMPVGbin5g1+3yKruh4k/CFljoaCy2blTT9UpgXn8cLFE112ffef0WoiMm5waFbyA3FIf6F1zmwTSRQhUEI5HysU6ZZOgz2JwTFhV+l/DRUR8394LMZv3fJ/NX10gD3YtD3IhP3TVtNrzad4yNHKalkHNvoxXpOkb25SXfEvE3/Srg1jBYCCiEaT/s9sW0KkYQzfkTCnymqcDlSmy4mVd02fIkPMEa...]

    [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) +116
    System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +251
    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() +220
    System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
    System.Web.UI.Page.LoadAllState() +35
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
    System.Web.UI.Page.ProcessRequest() +86
    System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
    System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    ASP.sample_hp_displayitemidsearchsample_aspx.ProcessRequest(HttpContext context) +29
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
     

Share This Page