Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3241022
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:09:05+00:00 2026-05-17T18:09:05+00:00

Recently, I discovered that the Web.Config file contains an <appSettings> section which seemed good

  • 0

Recently, I discovered that the “Web.Config” file contains an <appSettings> section which seemed good for storing one’s Application Settings. Heck, it even has a programmatic way to access the file thru a standard System library. So being all clever, I wrote an Interface to access it and then a Concrete implementation of the interface, shown here:

public interface IAppSettings
{
    IEnumerable<string> GetValues(string componentName, string settingName);
    IEnumerable<KeyValuePair<string, string>> GetValuePairs(string componentName, string settingName);
    void SetValues(string componentName, string settingName, IEnumerable<string> valueList, bool append);
    void SetValuePairs(string componentName, string settingName, IEnumerable<KeyValuePair<string, string>> pairList, bool append);
}

Then I came to discover that saving settings back to “web.config” while the application is running causes the entire application to re-start. This seems completely unreasonable to me because if I’m writing back to web.config a lot and the application is restarting each time, then things like HttpRuntime.Cache get completely emptied effectively making my Cache useless because it’s constantly emptying and repopulating.

So I’m wondering: Where should I store my Application Settings?

Is there a good solution out there for this so that I don’t have to roll my own?

EDIT:

Okay, thanks to everyone who suggested using a DB and a potential table schema. I think I’m going to go with the following schema:

settings:
    index NUMBER NOT NULL AUTO_INCREMENT   <== Primary Key
    component NVARCHAR(255) NOT NULL
    setting NVARCHAR(255) NOT NULL
    key   NVARCHAR(255)
    value NVARCHAR(255) NOT NULL

Though I don’t think I’ll make the “setting” the P-Key, but use an Auto-Incr Index instead. This way if I have an application that needs to mail something to multiple managers, I can store many:

index     component       setting        value
1         RequestModule   ManagerEmail   manager1@someplace
2         RequestModule   ManagerEmail   manager2@someplace

And then I can use:

IEnumerable<string> GetValues(string componentName, string settingName);

And it will return a list of email addresses, rather than just a single value.

Does this make sense?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:09:05+00:00Added an answer on May 17, 2026 at 6:09 pm

    web.config is generally used for read-only settings, ie. the settings set during deployment of the application by the system administrator.

    If you want to read and write the settings, the most obvious way is to use the database. By the way, this has an advantage: an application can be hosted on several servers and will still read and write the settings correctly,

    You can also implement your custom storage for the settings, but it will be probably more difficult to implement and not much faster.


    To answer your second question, the structure of your database depends on the type of settings you want to store.

    If you need to store heterogeneous unique entries like this:

    • Mail address of an administrator,
    • Maximum number of entries to display on home page of the website,
    • Text to display on “About us” page,
    • Boolean value indicating whether public comments are enabled or not,

    then you have to use varchars or other more or less friendly types as keys to identify the entries (rather than to refer to them by their index).

    On the other hand, if your purpose is to store the mail addresses of several managers, you should create a Manager table containing their mail addresses, names, datetime of their last connection, etc.

    You really shouldn’t mix both. In theory, you can refer to the entry in settings by component/setting pair. In practice, it makes things harder and creates a bunch of problems:

    • What if, further, you will need, for every manager, to store a boolean value indicating whether she/he wants to receive alerts from you? With your current structure, this will be impossible.
    • Since the same setting can have multiple values, how do you intend to handle the settings which must be unique? For example, there must be only a single value of text to display on “About us” page. What if there are two values stored in database?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently discovered that MVC is supposed to have two different flavors, model one
Possible Duplicate: Encrypting/Hashing plain text passwords in database Recently, I discovered that major web
We recently discovered that the Google Maps API does not play nicely with SSL.
I only just recently discovered that Visual C++ 2008 (and perhaps earlier versions as
Recently I have discovered that my release executable (made with msvc++ express 2008) becomes
I have recently discovered that I am affected by this bug http://www.mail-archive.com/mono-bugs@lists.ximian.com/msg71515.html Well, at
I recently discovered Pinax that appear to be an django stack with added most-used
I've recently discovered a possible candidate for dependency injection in a .Net application I've
Our application has a couple of shell scripts that are called from web-based Oracle
I recently discovered that UIView s should only have UIViewController s when they fill

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.