Hello
In the past few days our ASP.NET webapp has thrown cryptographic exceptions(see logentry at the end of the post).
Since I'm pretty novice on Cryptography, I wonder if anyone have any idea what causes this, and can give me a quick explanation?
logentry:
2007-11-01 22:30:04,515 [3904] ERROR EPiServer.Global [] - 1.2.4 FormsAuthentication failed
Exception: System.Security.Cryptography.CryptographicException
Message: Bad Data.
Source: mscorlib
at System.Security.Cryptography.CryptoAPITransform._DecryptData(IntPtr hKey, Byte[] rgb, Int32 ib, Int32 cb, Boolean fDone)
at System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
at System.Web.Configuration.MachineKey.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length)
at System.Web.Security.FormsAuthentication.Decrypt(String encryptedTicket)
at EPiServer.Global.FormsAuthentication_OnAuthenticate(Object sender, FormsAuthenticationEventArgs e)
Problem solved. As a reference for others, this is because of load balancing and viewstate encryption. You need to make sure all servers in a web farm has the same machinekey in web.config.
/Steve