Padding is Invalid and Cannot Be Removed
On some of the ASP.NET sites I maintain, every once in a while I get the following error showing up in my logs...
Request Path: /Webresource.axd
Error: System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed.
at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte inputBuffer, Int32 inputOffset, Int32 inputCount, Byte& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte buf, Byte modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo)
at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType)
at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I am going to be straight up with you -- I'm kind of foggy on what most of this gobbledygook means. The cause of this was a mystery for a little while, until I reconfigured my error reporting module to show the page referrer, and discovered that every single one of these errors was being generated by Google's caching system.
Beneath each result in a Google search, there is a link called "Cached". Clicking on this link provides a snapshot of Google's cached version of the page:
Whenever someone would click on this link to display the cache, it would generate this exception. Oddly enough though, the exception doesn't bubble up to the client, so the end user is none the wiser.
That being the case, I feel pretty confident in simply ignoring these errors. If you find this happening, check the referrer. If you find it's being caused by the Google cache, I wouldn't worry too much about it.
Subscribe to this blog for more cool content like this!