Search code examples
c#configurationsandbox

Is it possible to use System.Configuration, if there is no local app.config? And how to, if it is possible?


I have a client apllication that run in very restricted area - it has no direct access to computer, where it is running. I don't want to invent another one System.Configuration system to configure my application.

But there is no method in ConfigurationManager, that allows to load configuration from string or Stream.

It seems to me that it's impossible to use a ConfigurationManager in this particular scenario, but may be (and I hope to) wrong?


Solution

  • ConfigurationManager and WebConfigurationManager work exclusively with configuration files. This is because of the way the .NET configuration system is designed to cascade through folder hierarchies.

    If you don't have access to the file system from your application, you wont be able to work with these classes.