Reputation: 281
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?
Upvotes: 21
Views: 34067
Reputation: 1982
Just place it under <system.web>
If you need a key generated, use the process as shown in this SO post
Upvotes: 28
Reputation: 514
Get keys from sites can be a risk of security.
there's a simple way to do it, just use your IIS console
The IIS Console open. Click in Computer Keys
The next step is set your keys. Select the appropriate, unflag the boxes to generate manually your keys, and finally click Generate Keys.
Finally, go in your Web.Config and above the set the tags.
z
Upvotes: 3
Reputation: 101
Put Code in and generate machine key from this link
http://www.eggheadcafe.com/articles/GenerateMachineKey/GenerateMachineKey.aspx
Upvotes: 1
Reputation: 34408
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.
Upvotes: 10