Validation of Viewstate MAC Error - Blank Searches

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
sdlong02
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 95
Joined: Mon Jan 19, 2009 2:33 pm

Validation of Viewstate MAC Error - Blank Searches

Post by sdlong02 » Thu Apr 23, 2009 6:08 pm

This is the only time I'm able to reproduce the error and it doesn't happen everytime, but if I continually search for something on my website that doesn't exist, it will eventually give me the viewstate error.

I have already added a machinekey to the web.config but am still able to reproduce the error.
I also tried changing the encryption.config file as suggested in one of the other threads.

Any suggestions?

niall08
Commander (CMDR)
Commander (CMDR)
Posts: 175
Joined: Tue Dec 09, 2008 10:29 am

Re: Validation of Viewstate MAC Error - Blank Searches

Post by niall08 » Fri Apr 24, 2009 3:51 am

Our client has noticed the same intermittant problem - the error reads:
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request


User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Validation of Viewstate MAC Error - Blank Searches

Post by jmestep » Fri Apr 24, 2009 6:24 am

I ran into a problem on certain browsers:
viewtopic.php?f=42&t=9841&hilit=viewstate+mac
Also, do you have any forms on the page that you have entered, like an email sign up form? If you have and have entered <form> tags around it, that could be causing the problem since the pages automatically generate a form for the entire page.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

niall08
Commander (CMDR)
Commander (CMDR)
Posts: 175
Joined: Tue Dec 09, 2008 10:29 am

Re: Validation of Viewstate MAC Error - Blank Searches

Post by niall08 » Fri Apr 24, 2009 8:52 am

It was in IE7 - and it was a product page that produced the error.

I've asked the client for more details the next time that the error occurs.

In the meantime I've followed your advice and added the machinekey - handy posting that - thanks ;)

sdlong02
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 95
Joined: Mon Jan 19, 2009 2:33 pm

Re: Validation of Viewstate MAC Error - Blank Searches

Post by sdlong02 » Fri Apr 24, 2009 10:04 am

I've already used the tool in the Wiki to add the machinekey, not sure if this helps but here is the stack trace in the error:

Code: Select all

System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +437
   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +291
I also tried changing the encription.config from

Code: Select all

<encryption />
to

Code: Select all

<encryption></encryption>>
Thanks for the suggestion Judy, but I do not have any custom forms on the page.

Aside from disabling the viewstate, is there anything else that could be causing this?

sdlong02
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 95
Joined: Mon Jan 19, 2009 2:33 pm

Re: Validation of Viewstate MAC Error - Blank Searches

Post by sdlong02 » Fri Apr 24, 2009 10:16 am

Also, I'm not sure if this is related, but I can't access my EncryptionKey.aspx

When I attempt to load the page, it asks me to login again, when I enter my credentials the login page just refreshes.

afm
Captain (CAPT)
Captain (CAPT)
Posts: 339
Joined: Thu Nov 03, 2005 11:52 pm
Location: Portland, OR
Contact:

Re: Validation of Viewstate MAC Error - Blank Searches

Post by afm » Fri Apr 24, 2009 11:17 am

Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing

sdlong02
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 95
Joined: Mon Jan 19, 2009 2:33 pm

Re: Validation of Viewstate MAC Error - Blank Searches

Post by sdlong02 » Fri Apr 24, 2009 1:59 pm

Not from what I can tell, but maybe you see differently, here is my full stack trace:

Code: Select all

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

[ViewStateException: Invalid viewstate. 
	Client IP: 192.168.10.11
	Port: 2251
	User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; WOW64; GTB5; .NET CLR 2.0.50727; InfoPath.1)
	ViewState: 9+EyfvAQJZRZlYPgp/oXPLj93folmQfQK5+dICtMBNLMd+CDwyvSxjYmRLakZf3328YpU3ZtQVrq5hMCIRhBG0rkW1TT/UNRETeo8XKdI5IvfTHgrPAl4e7pXlF9qzz0yH3q/PXLkyViIms9y7vFmvW8WBocbq3NJEi86WNo/DHzATRWOFX1B1uXpdCzl3pYCTi4qi+TBWOZjv4sAlOq7G2ZAq0CVkrzpoe+Kc/lIHtORksDlTBjSNoNZZnyBriU1gRCHUG3t0Eabx69TuFlCFfHhAsKdZsWYa83XfPg1ofd0JiXOzpD774cFe7VZhmcN2FuFlrNeg5REjpJpcmoaprU5GKFFHxwcOM3Z0cW1+AGLwwLBMuxGJz5khME5dFgkMjG8h92FsgtE9KqYehdUOSW6d+xhsAQo7vPIVII71ZJuQMCZxvSkuhtb0U2uOjk2sUkwTlq9yH4j9To/uc6U5sGpbMcoudPj9+SZErPWGGp8kBr7aKZKq7FmlSQ3l6xvwY6fD+VJ2nfqymdQsVWoCaa97TTcam845E8JclpHaxhthzqY1oMNCrm1Ft4OKFKHu8iR2IMFn+qWNF8FYSz0dTzTW0zi+dynL3bBSvp2vyO7q1hplNJhD8phdrUJwaKCmjo1lIKzdAm6a1Vmj1jWRGCqJ1Q92h8vzyl3pdz9v5zW/PygDOyTku6fSbXaoS2+nVseClV+VDK7Lfakx6mHL3gHC3f58RSUFzpb1qiHIwa4HobAB0dSYKrcFE7lOWf7rOhXz/DWjx0EVR9061IltJG0y1kHyGzLRQ5KWYW+X1JeMFymajByqmmDsUNVMvgjZWifVY7P8bzHH8nYB5wXTegi...]

[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) +163
   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +554
   System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +88
   System.Web.UI.HiddenFieldPageStatePersister.Load() +264
   System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +279
   System.Web.UI.Page.LoadAllState() +44
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5268
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +236
   System.Web.UI.Page.ProcessRequest() +105
   System.Web.UI.Page.ProcessRequest(HttpContext context) +292
   ASP.search_aspx.ProcessRequest(HttpContext context) +16
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +499
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +177

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Validation of Viewstate MAC Error - Blank Searches

Post by jmestep » Fri Apr 24, 2009 3:38 pm

I do remember also reading something on view state that it can be corrupted if the page doesn't finish loading before something else on it is clicked.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

afm
Captain (CAPT)
Captain (CAPT)
Posts: 339
Joined: Thu Nov 03, 2005 11:52 pm
Location: Portland, OR
Contact:

Re: Validation of Viewstate MAC Error - Blank Searches

Post by afm » Sat Apr 25, 2009 3:39 pm

jmestep wrote:I do remember also reading something on view state that it can be corrupted if the page doesn't finish loading before something else on it is clicked.
Only if you move ViewState to the bottom of the page. Normally, ASP.NET puts it at the top so the browser renders it before any controls that can cause a postback. If you move ViewState to the bottom, then the controls are rendered before the ViewState. If you click on one of those elements before ViewState then the postback will not have a valid ViewState and you will get this error.

Unfortunately, this is only one of possibly dozens of reasons the ViewState could be corrupted.
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing

Post Reply