I have some configuration values for an asp.net web app. They will be maintained by a system admin once the system goes live. Should I store these values in the database or in a config file? Is there a best practice for this sort of thing?
It's easy and convenient to create a robust interface to edit the values in the database.
It's less easy to create a good one for the config file.
So I would usually you want to store everything which you would like your users/administrators to be able to edit later in the database. Everything which only needs to be touched during serious changes like re-installation etc is better off in the config file.
I would always recommend database simply because you can build an Admin UI relatively easy and audit all changes with similar ease. Although you can accomplish the same with changes to a file, the database route with some sort of a Admin control area is always preferable. Especially when you want to know who changed what when.
Also in our environment, changing a config file if there was an error, involves the entire change management process approvals/etc., which is pretty painful. So if you take the time to incorporate configuration settings in a database I think it will work out better in the long run. Just my $0.02.
I prefer a text config file, .ini style or XML style for these two reasons:
1 - You can put comments in the text file.
2 - Text editors have an "undo" command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With