Separate DLL.config file...reading settings

Administrator

VB.NET Forum Admin
Joined
Jun 3, 2004
Messages
1,462
Programming Experience
10+
I don't want to read settings from the web.config but instead an "app.config" type setup for my asp.net applications. For example: I have an assembly Neal.DLL. I then create a Neal.DLL.config file. Is there an automated way of reading appSettings out of this file or do I simply need to use the XMLTextReader to parse it? Not sure if since my app is running as Neal.DLL if there was an easy way of reading a file with the same Assembly name ending in .config.

Thanks!
 
The only way I know of to reference another .config file automatically is by using the "file" attribute within your existing web.config file.

For example:
<appSettings file="user.config">

Then, if this file exists, all settings will be used from the user.config file will get precedence over those within web.config.

The user.config file simply contains the <appSettings> attrubite and normal keys...
 
I did some research. Looks like Winforms uses App.config, Webforms web.config, beyond that you need to use XmlTextReader. Which is fine. Just seeing if there were any shortcuts before generating code. .NET has a lot of shortcuts and tricks but you have to find them! :)
 
So essentially you're going to build your own .config reader class I assume? Out of curiosity, what's your reasoning for doing this? Multiple config files in one bin directory?
 
Localization routines, configuration settings outside the web.config to avoid recompiles when changed, etc. Lot's of reasons, lot's of uses. I already do this with a customization routine in quikSlip for StoreFront where you can change colors, localization (text values) etc. Works like a champ.
 
I couldn't make up my mind which to use, Administrator, neal007, or Neal (and one other) but I'm sticking with Neal now! :) A little identity crisis! :)
 
Back
Top