Creating a Machine Key for ASP.NET applications

Categories Web HostingScriptingASP.NET

Customers utilising the ASP.NET hosting infrastructure can increase performance of their application by setting a unique MachineKey in their web.config configuration file. This MachineKey assists in validating session data.

Generate a unique MachineKey

To create a MachineKey for your application, simply visit the vendor's website by clicking here. The tool creates a 256-bit decryption key and a 512-bit validation key, with Rijndael as the data validation algorithm. Once the keys are generated, they are converted into a string of hexadecimal characters.

Use the MachineKey in your application

To apply the key to your application, simply copy the code into your web.config file, then re-upload it to the server. If you are creating the MachineKey to fix your session handling, see below for an example of what your <system.web> web.config directives code should appear as.

Note: The values shown for validationKey and descriptionKey are examples only and will not work on a live website:

<machineKeyvalidationKey="1234567890123456789012345678901234567890AAAAAAAAAA"decryptionKey="123456789012345678901234567890123456789012345678"validation="SHA1" decryption="Auto" />
<sessionState mode="StateServer"stateConnectionString=""stateNetworkTimeout="10" timeout="20" />

Rate this article
Get more leads