Reputation: 191
I have a .NET application that needs to reference a global application variable, a number, which is used by the application to allow/disallow users to enter events prior to a date. Currently I have
<appSettings>
<add key="beginDateRangeDays" value="60" />
<add key="endDateRangeDays" value="30" />
</appSettings>
in my Web.config. I want the admin users to be able to modify those values periodically via an admin web page. If I allow this, every time they make a change, my app pool will restart.
Where would you recommend storing this? In an external config file? But will that also cause an app pool restart? Should I use a config table in the application's database?
Upvotes: 1
Views: 450
Reputation: 95
If you store it in the database then you have control over who accesses it and when. Then you need not worry about making the app pool restart.
Upvotes: 0
Reputation: 10390
You should be able to setup application settings, such that they are editable in IIS. See this TechNet article:
http://technet.microsoft.com/en-us/library/cc753062(v=ws.10).aspx
Upvotes: 0
Reputation: 218827
I want the admin users to be able to modify those values periodically via an admin web page
Database, definitely. The config file is a convenient place to store non-static values, but not always the best place. Step back for a moment and consider two "buckets" of such values:
The former is best kept in the application's database, the latter in the config file. The former might contain values like:
While the latter might contain values like:
Let the users change things that they can change without physically breaking the application, and track those changes in the database. Keep the infrastructure details in the config file, since a change to those details would very likely require an app pool restart anyway.
Upvotes: 3