Hi,
Is there a way I can create a blah.config file in asp.net, and access the name/value pairs of nodes the same way you access items in in a regular web.config file?
(the idea is to not have to write any custom code for this).
Hi,
Is there a way I can create a blah.config file in asp.net, and access the name/value pairs of nodes the same way you access items in in a regular web.config file?
(the idea is to not have to write any custom code for this).
Use the "file" attribute of the appSettings block, like so:
<appSettings file="user.config">
<add key="Test1" value="Generic1" />
<add key="Test2" value="Generic2" />
</appSettings>
Further explanation available here.
Chris shows one way to "externalize" part of your configuration. That works fine for certain scenarios. If you need more, you'll need to dig in a bit deeper.
For that, you should definitely check out Jon Rista's three-part series on .NET 2.0 configuration up on CodeProject.
Highly recommended, well written and extremely helpful! He shows how to create and use custom configuration sections, and goes on to explain how to use your own blah.config
instead of or in addition to standard .NET config files.
Marc