none
Application Configuration Versus Application Settings RRS feed

  • Question

  • Hello all,

    I am new to this community. I've Visual Studio 2008 Sp1 installed on windows 7 RC1. Can somebody here explain me about Application Configuration and Application Settings. I think these 2 are very similar. And in what situation should I choose one over another?

    One more thing, I can see that in the case of application configuration, all the information is saved in an XML file and stay in a seperate file, appname.exe.config, in the same directory as the main assembly. but in the case of application settings, can you tell me when I store some information and its type is application, and when I deploy the assembly, where is the information stored? is it inside the assembly or in a seperate file and where is that file if it is the case?


    Thanks,

    nsophat20
    Friday, September 11, 2009 6:47 AM

Answers

  • I cannot explain as much as you expected but try this,
    Application configuration files,
    http://www.developer.com/net/net/article.php/3396111
    Application Settings,
    http://msdn.microsoft.com/en-us/library/k4s6c3a0.aspx

    Hope this will give you an idea as well as to me also,
    Regards,
    • Marked as answer by eryang Wednesday, September 16, 2009 6:59 AM
    Friday, September 11, 2009 7:26 AM
  • Hi Kok,
    I got a little confused about your last question, but I have something to share with you:
    1. We can access those Application Setting by using System.Configuration.ConfigurationManager.AppSettings["your key1"],
    2. The Application Settings are stored in a global cache, and its value is loaded from disk at the first time you access it using System.Configuration.ConfigurationManager.AppSettings["your key1"].
    3. If the .config file was deleted before ConfigurationManager load it, you cannot get appsetting values and your application may run into invalid status or crash. If the .config file was deleted after been loaded, you still can get appsetting from the global cache.

    Thanks,
    Eric
    Please remember to mark helpful replies as answers and unmark them if they provide no help.
    • Marked as answer by dara kok Thursday, September 17, 2009 11:08 AM
    Tuesday, September 15, 2009 5:36 AM

All replies

  • I cannot explain as much as you expected but try this,
    Application configuration files,
    http://www.developer.com/net/net/article.php/3396111
    Application Settings,
    http://msdn.microsoft.com/en-us/library/k4s6c3a0.aspx

    Hope this will give you an idea as well as to me also,
    Regards,
    • Marked as answer by eryang Wednesday, September 16, 2009 6:59 AM
    Friday, September 11, 2009 7:26 AM
  • Another link
    http://www.builderau.com.au/program/web/soa/Store-NET-application-settings-in-custom-XML-config-files/0,339024632,320265625,00.htm
    Friday, September 11, 2009 7:31 AM
  • Thank AUmidh for your comments.

    Now i have a better understanding of the way configuration works.

    Can you answer me one more thing? When i have app.config defined in my project, and when i create a new property in application setting, the new property is reflected in the app.config file. So I wonder where the application setting property is stored in case i delete the app.config file.
    Monday, September 14, 2009 3:21 AM
  • Hi Kok,
    I got a little confused about your last question, but I have something to share with you:
    1. We can access those Application Setting by using System.Configuration.ConfigurationManager.AppSettings["your key1"],
    2. The Application Settings are stored in a global cache, and its value is loaded from disk at the first time you access it using System.Configuration.ConfigurationManager.AppSettings["your key1"].
    3. If the .config file was deleted before ConfigurationManager load it, you cannot get appsetting values and your application may run into invalid status or crash. If the .config file was deleted after been loaded, you still can get appsetting from the global cache.

    Thanks,
    Eric
    Please remember to mark helpful replies as answers and unmark them if they provide no help.
    • Marked as answer by dara kok Thursday, September 17, 2009 11:08 AM
    Tuesday, September 15, 2009 5:36 AM