sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Tom's Avatar

Crazy ConfigurationManager


Question posted by: Tom (Guest) on August 8th, 2008 10:45 PM
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?!?



0 Answers Posted
 
Not the answer you were looking for? Post your question . . .
197,037 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 197,037 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors