Validation of viewstate MAC failed when taking a while to postback

I have ap age that has a number of dropdowns and textboxes that allow a user to enter a football team and the result of a fixture.

if you entyer the information quickly then every thing works fine and the page saves correctly.

however if you take a while to click the save button when you do so you get the 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:

I've tried reading up on this and the only thing that i thought may be applicable to me is the recycling of the application pool?

does this sound likely?

the user doesnt have too take an excessive long time to get this error so i need to get it sorted as it is becoming an iusse.

any ideas? i will post the full error page below
scm0smlAsked:
Who is Participating?
 
MikeMCSDConnect With a Mentor Commented:

Go to this link: http://aspnetresources.com/tools/keycreator.aspx

Leave the defaults in place, validation key length 64, encryption key length 24, type sha1. Click Generate to create a random machine key for you and copy the result.

Now open the web.config file from your site.
And paste in the <machineKey ... />

<system.web>
<machineKey validationKey="6DF5E433D9405FB87840F9 ..........
decryptionKey="9BACA138B26E399751CE4132180179B874 ............

0
 
scm0smlAuthor Commented:
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:


[HttpException (0x80004005): Unable to validate data.]
   System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +2546748
   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +214

[ViewStateException: Invalid viewstate.
      Client IP: 90.199.172.112
      Port: 63763
      User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2)
      ViewState: /wEPDwUJNjEzMDY3ODk3D2QWAmYPZBYCAgMPZBYCAgEPZBYEAgMPEA8WBh4NRGF0YVRleHRGaWVsZAUHRml4dHVyZR4ORGF0YVZhbHVlRmllbGQFCUZpeHR1cmVJRB4LXyFEYXRhQm91bmRnZBAVBAlTZWxlY3QuLi43QWZhbiBMaWRvIHZzIFRhZmZzIFdlbGwgLSAxc3QgVGVhbSAtIFdlbHNoIExlYWd1ZSBEaXYgMVJUYWZmcyBXZWxsIEFGQyB2cyBUdXJiZXJ2aWxsZSBBcm1zIEZDICAtIFJlc2VydmUgVGVhbSAtIFNvdXRoIFdhbGVzIEFtYXRldXIgTGVhZ3VlR1RhZmZzIFdlbGwgdnMgQ3dtYnJhbiBDZWx0aWMgLSBZb3V0aCBUZWFtIC0gV2Vsc2ggTGVhZ3VlIFlvdXRoIERpdiBFYXN0FQQBMAMxNzUDMTg0AzE2MRQrAwRnZ2dnZGQCCw8WAh4HVmlzaWJsZWcWBgIBDw8WAh4EVGV4dAUJQWZhbiBMaWRvZGQCBw8PFgIfBAUKVGFmZnMgV2VsbGRkAg8PZBYgAgEPEA8WBh8ABQhGVUxMTkFNRR8BBQhQTEFZRVJJRB8CZ2QQFXgJU2VsZWN0Li4uGEFhcm9uICBUaG9tYXMgLSAxc3QgVGVhbRZBbGV4ICBOb3J0aCAtIDFzdCBUZWFtGkJhcnJ5ICBSaWNoYXJkcyAtIDFzdCBUZWFtG0N1cnRpcyAgTWF0dGhld3MgLSAxc3QgVGVhbRVEYWxlICBSZWVzIC0gMXN0IFRlYW0aRGF2ZSAgTWMgS2Vu...]

[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.admin_newresult_aspx.ProcessRequest(HttpContext context) +4
   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
0
 
scm0smlAuthor Commented:
ok i will try that once i get in later.

do you mind giving me a brief explanation of the problem and how your link fixes it tho?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
scm0smlAuthor Commented:
this seems to have fixed the issue, the link you gave creates the key but there is no real explanation as to why i need it or what the problem was in the first place.

can you just give me a brief overview of the prob and how this key fixes it.

thanks
0
 
MikeMCSDCommented:
The explanation is explained in the error:

  "this application is hosted by a Web Farm or cluster . . ."

there is nothing more to explain about it.
0
 
MikeMCSDCommented:
Also, my solution solved the problem:

  "this seems to have fixed the issue .  . "       -  from scm0sml

0
All Courses

From novice to tech pro — start learning today.