Error changing machineKey

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
9/30/2010 7:57:15 AM
Gravatar
Total Posts 115
mojoPortal Community Expert

Error changing machineKey

Windows Server 2008R2
SQL 2008R2
2.3.5.3
ASP.Net 4

Working with a fresh install of Mojo everything is works until I change the machineKey. When the default admin or a new user tries to login the site throws the following message

2010-09-30 08:46:14,126 ERROR mojoPortal.Web.Global - 74.218.166.234-en-US - /Secure/Register.aspx 
System.Web.HttpException (0x80004005): Unable to validate data.
   at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo, Boolean useLegacyMode, IVType ivType, Boolean signData)
   at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo, Boolean useLegacyMode, IVType ivType)
   at System.Web.Security.FormsAuthentication.Decrypt(String encryptedTicket)
   at mojoPortal.Web.mojoRoleProvider.GetRolesFromCookie()
   at mojoPortal.Web.mojoRoleProvider.GetRolesForUser(String userName)
   at System.Web.Security.RolePrincipal.IsInRole(String role)
   at mojoPortal.Business.WebHelpers.WebUser.IsInRole(String role)
   at mojoPortal.Web.UI.AnalyticsAsyncTopScript.DoInit()
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

If I put the default machineKey back in everything works. I used IIS manager to generate the key and the passwords are set to the default of clear text.
 

9/30/2010 8:10:13 AM
Gravatar
Total Posts 18439

Re: Error changing machineKey

If its a new install, then I would change the machine key, clear the browser cookies before you login, and that should solve it. I actually added error handling there for an error I got with this during testing, but I was getting a cryptography exception, I'm kind of surprised it would throw a more general httpexception there. Is this after installing the new security update patches form Microsoft? I wonder if the update changed the error. I will add logic to catch this httpexception.

Best,

Joe

9/30/2010 8:10:58 AM
Gravatar
Total Posts 115
mojoPortal Community Expert

Re: Error changing machineKey

Thanks Joe. Clearing the browser cache did work. But yes the updates from MS have been applied to the server.

9/30/2010 8:13:38 AM
Gravatar
Total Posts 18439

Re: Error changing machineKey

So my guess is that part of their fix was to not throw CryptographicException when decryption errors occur, but instead throw a more generic httpexception.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.