.NET 2.0 Configuration and arbitrary config files.

  • Thread starter Thread starter Joel
  • Start date Start date
J

Joel

Greetings,

I have a requirement in an ASP.NET application to load configuration
information from an arbitrary location outside of the web root.
Specifically, the customer wants to create multiple virtual directories
that
all point to the same physical directory containting the ASP.NET
application
files. Each virtual-directory-instance should load its configuration
information from a location outside of the web root, based on the name
of
the virtual directory it is running from. That way, they can have
multiple
instances of the application connecting to different databases, without
duplicating all of the program files.

My question is, in .NET 2.0 does the System.Configuration namespace
provide
a way to accomplish this? Can I just pass it the path to the config
file I
want it to load? Perhaps with a custom WebConfigurationFileMap or
something? I looked at OpenExeConfiguration, which seems to be the only
overload of anything related that accepts a path parameter, but it
doesn't work. It returns a default Configuration object instead of one
representing the config path I passed in. From what I can tell in the
documentation, this method is expecting the path to an EXE, not the
path to a config file.

Or am I going to be forced to write my own configuration system because
System.Configuration lacks this flexibiliity?

Thanks,

Joel
 
Back
Top