Вопрос

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?

Это было полезно?

Решение

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

Другие советы

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

type inetMgr in Start

The IIS Console open. Click in Computer Keys

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.

Screen where generate your keys

Finally, go in your Web.Config and above the set the tags.

Setting the keys in web.config

z

Put Code in and generate machine key from this link

http://www.eggheadcafe.com/articles/GenerateMachineKey/GenerateMachineKey.aspx

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top