C# - app config doesn't change

Viewed 12561

I want to save some settings on a config file for future use. I'm trying to use the regular code that I see on all the tutorials -

 Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
 config.AppSettings.Settings["username"].Value = m_strUserName;

 // I also tried - 
 //config.AppSettings.Settings.Remove("username");
 //config.AppSettings.Settings.Add("username", m_strUserName);

 config.Save(ConfigurationSaveMode.Modified);
 ConfigurationManager.RefreshSection("appSettings");

Now - I can see that on runtime - the file "...vshost.exe.config" on "Debug" folder is changes, nut when I close my application - all the changes are deleted. What can I do?

2 Answers
Related