4

I need to change a .NET app's configuration at runtime (to be precise, at startup).

The app doesn't have write access to the place where the app.config (or web.config) is saved.

The configuration section I need to add is third-party (by Oracle), so I cannot just change the way the configuration works.

Also, I don't have a custom ConfigurationSectionHandler, because the config section is by Oracle, and apparently they don't provide a config section handler class to read from the section.

Is that possible?

Bass
  • 378
  • 5
  • 15
  • 2
    so the goal is to add a configuration or to be able to connect to a Oracle database ? – Mauricio Gracia Gutierrez Aug 29 '13 at 13:41
  • 1
    The goal is to add a configuration 'in-memory', without changing the actual app.config file. – Bass Aug 29 '13 at 14:16
  • Bastian I still dont see the point for this, if you know the values that your configuration section is going to have, just store them in your code, since editing "in-memory" but not storing them will be pointless – Mauricio Gracia Gutierrez Aug 29 '13 at 14:31
  • I see your point, but believe me, I have a valid reason for modifying the configuration at startup ("in-memory"). If necessary, I could explain the reasons, but I think that would be off-topic. – Bass Aug 29 '13 at 17:09

1 Answers1

1

Yes, this is possible. Web.config can include sections from other config files. You add them as sections in your web.config. Changing web.config causing web app to restart but changing those children files doesn't. Opening a non web.config file as a configuration object

Community
  • 1
  • 1
T.S.
  • 18,195
  • 11
  • 58
  • 78