System.Web.HttpException: Validation of viewstate MAC failed

Topics: Support Request
Apr 12, 2010 at 5:16 PM



I have setup the latest dasBlog on shared hosting with GoDaddy ( 2.0, IIS7):


Occasionally in the events I notice the error I copy pasted below.


I can replicate this by

1. log in on one tab of IE8,

2. on a separate browser tab use the GoDaddy web interface to recycle the app pool,

3. then go back to the first tab and try and browse.

4. It throws me out - fine. I then try to re-login and it fails with "An error has been encountered while processing the page. We have logged the error condition and are working to correct the problem. We apologize for any inconvenience.".

5. Close the browser and start a new instance: now I can log in fine and see that the previous errors are mapped to the MAC failed error I pasted below.


Any ideas how to avoid running into this please?






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. ---> System.Web.UI.ViewStateException: Invalid viewstate.

Client IP: SNIP

Port: 35971

User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; Tablet PC 2.0; .NET4.0C; .NET4.0E)

ViewState: /wEPDwUJMjcyNzcyNjQ3D2QWAmYPZBYCAgsPZBYEAhkPDxYCHgljaGFsbGVuZ2UFGG8wbTJiNDNsMHBxNGpoYWpubmhmeXp2YmQWCgIBDw8WAh4EVGV4dAUIVXNlcm5hbWVkZAIGDw8WAh8BBQhQYXNzd29yZGRkAgoPEA8WAh8BBQ5SZW1lbWJlciBMb2dpbmRkZGQCDA8PFgIfAQUHU2lnbiBJbhYCHgdvbmNsaWNrBRZkb0NoYWxsZW5nZVJlc3BvbnNlKCk7ZAIODw8WAh4HVmlzaWJsZWhkZAIpD2QWBGYPFQEfaHR0cDovL3d3dy5kYW5pZWxtb3RoLmNvbS9CbG9nL2QCAQ8WAh4FdmFsdWUFBlNlYXJjaGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFGUxvZ2luQm94OnJlbWVtYmVyQ2hlY2tib3j1KaQvSatdHpbebk8+MKPM2a0zSA==


Path: /Blog/login.aspx ---> System.Web.HttpException: Unable to validate data.

at System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)

at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)

--- End of inner exception stack trace ---

--- End of inner exception stack trace ---

at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)

at System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState)

at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)

at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState)

at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState)

at System.Web.UI.HiddenFieldPageStatePersister.Load()

at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()

at System.Web.UI.Page.LoadAllState()

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

while processing

Apr 13, 2010 at 12:13 AM

I think this is caused by a bot submitting a form with bad view state,

Apr 13, 2010 at 1:18 AM

Thanks, but that is not the case here. My repro steps do not include a bot.

Other ideas please?