1

I have some important settings in the machine.config file and I need to prevent that websites can modify them in thier web.config files. In other words, I need those setting in the web.config files to be ignored.

I know I can lock elements but I don't want to have an exception, I just want to be ignored.

Example:

In machine.config

<appSettings>
   <add key="a" value="AAAA"/>
</appSettings>

In web.config

<appSettings>
    <add key="a" value="BBBB"/>
</appSettings>

In a website or webapplication

ConfigurationManager.AppSettings["a"]  // returns "AAAA" from machine.config 

Is it possible to do this?

Clarification:

These settings that I need to protect are the wcf serviceModel client elements and not appSettings as my example.

lontivero
  • 5,235
  • 5
  • 25
  • 42

0 Answers0