I need to store my application config settings in a hierarchical format in web.config or app.config. Is this possible? or I have to store it in some XML file or database and use it instead? plain name value pair format isn't enough for me.
It is a web-based reporting application and I need to store the file paths for the source files, SSIS packages, FTP server details etc.
Update: If I choose the custom config section option, can I store the settings in a separate file to keep the main web.config file clean from app settings?
Answer
You can't add custom elements to appSettings
.
The best way to achieve a custom format it to write your own ConfigurationSettings
class and use that in configuration.
This will allow you to store data in a strongly typed way as well as have meaningful element and attribute names.
See How to: Create Custom Configuration Sections Using ConfigurationSection on MSDN.
No comments:
Post a Comment