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?
I was getting "unable to validate data System.Web.Configuration.MachineKeySection.EncryptOrDecryptData" in my asp.net web app. I cleared my cookies, and the exception stopped.
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
In my case I had two web applications (one was very old and another one I just created) and despite having the same machine key settings tickets generated in one application were not usable in another. That was fixed by adding compatibilityMode="Framework20SP2"
as an argument for machineKey
node in web.config
in newer application.
Try adding a machine key to your web.config to see if that fixes the error
http://aspnetresources.com/tools/keycreator.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With