Validation of viewstate MAC failed

Discussion in 'ASP.NET 2.0' started by vagelis, Aug 28, 2010.

  1. i receive an error when the site i dont do anything as client in site for ten minutes(more or less)

    then if i click something i receive this error


    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.



    any idea why??
    and what i have to do?
     
  2. dmitri

    dmitri DiscountASP.NET Staff

  3. ok i choosed the solution of set the enableViewStateMac='false' and i think it works

    i hope that is not a problem to not have enableViewStateMac='true'
     
  4. i realized that i have problem again with tis issue

    when i use enableViewStateMac='false' when the time passes and i click in a page to redirect i receive the message that it doesnot find the redirection page in my site

    when i use
    <compilation debug="false" strict="false" explicit="true">
    <assemblies>
    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    </assemblies></compilation>

    <pages enableViewStateMac="true">

    <authentication mode="Windows">
    <forms loginUrl="login.aspx" name="myappauth"/>
    </authentication>

    i receive again the message for
    Validation of viewstate MAC failed

    any idea??
     
  5. ok it works for me with this code

    <compilation debug="true" strict="false" explicit="true">
    <pages enableViewStateMac="true"/>
    <machineKey validationKey="135265D42623958C1E84631D0AB327E8E433978BD4A28FC0A0CD71E38A5F3D4F950DD32034058613CBFF0890211D4E6F4C6E79EDC6A522572B31F3583DC5D929" decryptionKey="FE65F6B07ACA419BC98EC59992702913509ECDA570BDA0B86643F4EE21643671" validation="SHA1" decryption="AES"/>


    but in my page i have and a seconf web config inside a folder
    what have i to do to fix and the second web config?

    if i use the same i receive an error that has to do with the second machineKey in the project
     
  6. latisha11

    latisha11 Guest

    Lots of people waiting for an answer to this one. Is it something that is know and being fixed or are we all just completely lost and should give up and go back to 1.1?
     
  7. Well, imho, if ViewState is a nightmare for any project MVC3 may be the way to go.
    All the best,
    Mark
     
  8.  

Share This Page