Adding machineKey to machine.config
-
03-06-2021 - |
Pergunta
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?
Solução
just place it under <system.web>
if you need a key generated, i like to use the tool on this site: Machine Key Generator
UPDATE: The above link seems to be dead, here is another site to generate keys
Outras dicas
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.
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
Put Code in and generate machine key from this link
http://www.eggheadcafe.com/articles/GenerateMachineKey/GenerateMachineKey.aspx