4
votes

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?

1
so the goal is to add a configuration or to be able to connect to a Oracle database ?Mauricio Gracia Gutierrez
The goal is to add a configuration 'in-memory', without changing the actual app.config file.Bass
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 pointlessMauricio Gracia Gutierrez
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

1 Answers

1
votes

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