Padding is invalid and cannot be removed

by Svelmoe 23. October 2009 15:42

I experienced the following rather unhelpful exception at work today.
Padding is invalid and cannot be removed

With a stacktrace something along the following:

System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast) +7596702
System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) +208
System.Security.Cryptography.CryptoStream.FlushFinalBlock() +33
System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo) +225
System.Web.Security.FormsAuthentication.Decrypt(String encryptedTicket) +246

After doing some searching and more or less complex debugging, and resetting the application pool and what not, I find the simple solution.

I had two projects running on my localhost which both used the default cookie name for forms authentication, which then apparently conflicted with each other. Do’h.
But well, problem solved.

Comments

Add comment


 

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.4.5.0
Theme by Extensive SEO

About Svelmoe

My real name is Allan Svelmøe Hansen.

I live in Denmark, where I work as a developer for hedal:kruse:brohus using SQL Server and the .NET framework since 2004. Svelmoe.dk is a place for my every day thoughts and reactions and the occasional technical blog entry.

I also blog about SQL and MS SQL Server but have moved those posts to www.sqlstuff.dk so in case you are looking for more about that, please visit that website.