I would like to add the machineKey to my machine.config since I am working with programmatic encryption of web.config connection strings in a web farm scenario.
My question is, where do I place the machineKey in the machine.config file? There isn't one already there that I can replace, I suspect it's being autogenerated, so where should it be placed?
If you have access to the IIS management console for the server where Orchard is installed, it is the easiest way to set-up a machine key. Uncheck "Automatically generate at runtime" for both the validation key and the decryption key. Click "Generate Keys" under "Actions" on the right side of the panel. Click "Apply".
The Machine Key is used to hash and/or encrypt cookies for the Alpha Anywhere Application Server for IIS. If multiple servers running IIS have different Machine Keys, the cookies created on one machine won't be usable on the other.
The MachineKey section can be configured at the machine (Machine. config) or application (Web. config) level and controls the keys and algorithms that are used for Windows Forms authentication, view-state validation, and session-state application isolation.
"validationKey specifies a manually assigned validation key. This value must be manually set to ensure consistent configuration across a network of Web servers (a Web farm). The key must be a minimum of 40 characters (20 bytes) and a maximum of 128 characters (64 bytes) long.
Just place it under <system.web>
If you need a key generated, use the process as shown in this SO post
Inside <system.web>
:
<system.web>
<machineKey
validationKey="....."
decryptionKey="....."
/>
which is at the bottom of the file in mine at least. I don't think the order of elements in system.web matters, as long as it's the top level directly beneath the system.web element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With