Alex Rivera | Logout

What does an "Unable to validate data" exception in System.Web.Configuration.MachineKeySection.GetDecodedData indicate

Asked 2009-04-29T15:33:03.023
10

I've developed a website testing on localhost Cassini and it has always run fine, now when I deploy to my webserver I intermittently get the following error:

Global.Application_Error Error: Exception occurred during request: http://....blah.aspx 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) HttpApplication.RaiseOnError => EventHandler.Invoke => Global.Application_Error

This is being caught in my global.asax. I've searched around but can't find the cause. This exception is being thrown in extremely simple and small webforms. The site is not hosted within a webfarm.

2 pages seem to cause this error intermittently and one of them stores a bool in the ViewState, but it is not modified apart from that.

Has anyone come across this before?

Edit
Report

1 Answer

14

http://dotnetcoderoom.wordpress.com/2008/11/07/unable-to-validate-data-aspnet-error/

Cause: The basic reason of this is the difference of key while encrypting and decrypting the viewstate data. Suppose an asp.net rendered a page with key1 and saved the page state in view state, meanwhile asp.net’s key is changed to key2, now when some server side event will occur on page the viewstate will get decrypted and this error will occur as the old view state is now not valid due to a different encryption key.

It may occur when you open a page for along time and after that do some events on that.

Solution Fix the key in your web.config file, so that only one key is used to encrypt and decrypt the viewstate data.

For more information visit:

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/ASP_DOT_NET/Q_21321364.html

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q312906

answered 2009-04-29T15:36:05.340

Your Answer