My musings about .NET and what not

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.Security.Cryptography.CryptoStream.FlushFinalBlock()
   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.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   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!

kick it on

shout it on

vote it on

Bookmark / Share

    » Similar Posts

    1. Integrating Exception Handling Into the Development Cycle
    2. Building a TweetThis Extension with Automatic for Graffiti CMS
    3. Defensive Programming, or Why Exception Handling Is Like Car Insurance

    » Trackbacks & Pingbacks

    No trackbacks yet.
    Trackback link for this post:

    » Comments

    1. Sina Ahmadian avatar

      Thank you for this explanation! That helped me much.

      Sina Ahmadian — May 21, 2009 5:12 AM

    » Leave a Comment