Validation of viewstate MAC failed.

This is an open forum for any mojoPortal topics that don't fall into the other categories.

This thread is closed to new posts. You must sign in to post in the forums.
1/9/2011 9:29:42 PM
Koe
Gravatar
Total Posts 29

Validation of viewstate MAC failed.

Recently, when I want to update some settings on the website (update some module settings, user role settings, etc), sometimes it will come out this error. I know that it should be due to machine key setting but I don't know how to set it. Would it be due to using same machine for multi-machines? And how can I solve this problem?

 

Error message:

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:

[ViewStateException: Invalid viewstate.
Client IP: xxx.xxx.xxx.xxx
Port: xxxx
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 (.NET CLR 3.5.30729)
ViewState: NQcHAGOa3xPeH8IKE3PZjBaxVMJ7gpsV7BTUIWLGDsvF5jYyaKjYXs3oQu1QU6ZZFoh7PfT0wpCRLrnLNQtjSu/xOqgrrGbmG6IDEVmT5Had11gpO/TH4nAWIiAHkzA5SZOLssKKqTifGoly5CGtjIfquGT0qXY0nD1/Gr2m+VhpJyaRLnXuWx3UN1obyBFIiKdNsf1xVLBPvB0Q3Vs7C77xD30UCjd/ylNPlwS5z88TVne0SjKizqdWURRmzTfxNPgfvrY5A1GheLjPsfYaRlTJ6oiv9vt+kXN1HzjL08oeBsY74QTb5swgq8H+KanEH6wE652J9u1K/s3W9c9I6wHZbfsun7fnTI4C6nNsGiL7ZyKz/EoXwWiWr/23E9sfGZq5Dye8X5BmtepWx1LooblF065CnD3Wh1ppa/+LYjFYCHMWZKClUGk+imWnSKNdaDeTs9C7GGU5YigVSFQ3y0UnfKHSyqlFmjbMOu0mzDmKy0vUeYhywFt1drOejiKZQ9z4Ghre7oX/TJzppLeDJo7XJCp6wKsqPQeJBIzgmuFdZE2ltf3mLq0uGCFb2aCAV44nz/obG7/CcygiQgQJLlXWPgnddtCOKN8XBRcpAWkmCcQyXCu+7cRMu1B2HKNKsVxEuas/bn4sKqHnRaIxDc0T4nXshO8qGJeOS1/lmFZyG79aK241KX5FdQKAftTr+zP9SjtRRST5r8XKqN6DactADa7WBV7XqYIYAS1+Ypnpl+9GoUxDQIlHP6eAgM9Qqe76dJy2jkrlKBS3HZJXjq/Ewjwy2v9LdCUHrMHlgHX5ZvkNLh8LbOpfVM3ZzwWzAGS3mx3k11K...]

[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) +237
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.admin_manageusers_aspx.ProcessRequest(HttpContext context) +4
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618

1/10/2011 7:29:00 AM
Gravatar
Total Posts 18439

Re: Validation of viewstate MAC failed.

Hi,

mojoPortal uses a machine key in Web.config by default, though you are supposed to replace it with a custom one.

However, this error can be caused by other factors such as a slow connection and posting back before the page is fully loaded.

http://blogs.msdn.com/b/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx

is a good article about the kinds of things that can cause it and workarounds for it. Googleing this error will find lots of documents.

Hope it helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.