Connecting Tech Pros Worldwide Help | Site Map

Crazy ConfigurationManager

  #1  
Old August 8th, 2008, 10:45 PM
Tom
Guest
 
Posts: n/a
This seems odd ...

While debugging my application in VS2008, I can successfully retrieve values
from my configuration file doing the following:

string bla = ConfigurationManager.AppSettings["myValue"];

I can also successfully save to the config file doing the following:

Configuration c =
ConfigurationManager.OpenExeConfiguration(Configur ationUserLevel.None);
c.AppSettings.Settings.Remove("myValue");
c.AppSettings.Settings.Add("myValue", "ItsActualValue");
c.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings") ;

If I go into my debug directory on my file system and check my exe config
file, I can actually see that these settings have successfully been written
to the config file.

Here's the weird part:
When I'm finished debugging my app, I stop it by hitting (shift + F5). When
I do that, my exe config file somehow reverts back to the original state in
which these settings did not exist in the config file.

WTH?!?



Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Configuration. Help me, please, to spot the problem. ThankYou. shapper answers 2 November 7th, 2008 02:05 AM
Crazy ConfigurationManager Tom answers 0 August 8th, 2008 10:45 PM
Cracking ConfigurationManager Jonathan Wood answers 3 August 3rd, 2007 07:45 PM
XML to XML using XSL. Please, help me! Thank You! shapper answers 2 November 19th, 2006 03:05 AM