How do I know if the machineKey section from my ma

2019-07-22 08:47发布

问题:

I'm trying to generate a custom key for encrypting the web.config in a project, and use the same key on several machines.

I've followed this example from Microsoft: http://support.microsoft.com/kb/312906

However, when I encrypt my web.config (and I'm using cassini, not IIS, on my machine) it doesn't seem to use the newly created section in my machine.config. Or does it? How do I know? When I've made the changes and encrypted the web.config, the sites works just fine. And to try to prove that my custom key is used, I change a character in the decryptionKey value and restart the dev environment. But it still works, which I guess points to the fact that my keys aren't used.

What am I missing here?

回答1:

I've got a simple test... put some garbage (invalid XML) in your machine.config and restart your dev environment (not Cassini) and see if Cassini chokes, which would indicate that it is reloading machine.config.



回答2:

I forgot to specify which provider to use when encrypting. Everything worked fine after that.