Changing the Machine Key invalidates the DNN license and prevents logins


If the machine key for your application changes, you may receive a message indicating that the license has expired or is invalid. An altered machine key can also have other collateral errors such as:

  • Failure to log in with an error in the JS console reading:
    • Uncaught Sys.Webforms.PageRequestManagerServerErrorException: 
      You must specify a non-autogenerated machine key to store passwords
      in the encrypted format.
  • SQL errors in your site logs:
    • System.Data.SqlClient.SqlException (0x80131904): Connection Timeout Expired.  
      The timeout period elapsed while attempting to consume the pre-login handshake

This issue occurs due to a host setting, named hash, in the HostSettings table. It has a hash value that is generated when a license is activated and is based on the machine key. The machine key can change during a migration, or if a hosting company switches which server a DNN site is located on.




To resolve this issue, follow the steps mentioned below: 

  1. Run the following query on the database for your site:

    DELETE FROM HostSettings WHERE SettingName = 'hash'
  2. Navigate to IIS and recycle the application pool.

  3. Activate the license again.

    • If you load the site without adding the license, it will be displayed as unlicensed.



After the fix, you should be able to log in and your site should not display without any licensing errors.




Please sign in to leave a comment.