0

I am setting values in app.config using this code

string appPath = System.IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly().Location);          
string configFile = System.IO.Path.Combine(appPath, "App.config");
ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();         
configFileMap.ExeConfigFilename = configFile;          
System.Configuration.Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);
config.AppSettings.Settings["YourThing"].Value = "New Value"; 
config.Save(); 

I works fine, but when the data in app.config changes it asks me (pop up) for changes in app.config. I dont want it to ask for pop up for saving.

How can i stop from getting popup and also save app.config in background.

Thanks

Rahul J
  • 103
  • 1
  • 11
  • UAC popup? Are these user settings you want to save? If so you should use user level settings instead. See http://stackoverflow.com/a/1357453/512365 – KornMuffin Jul 05 '16 at 21:11

1 Answers1

0

Try refreshing the AppSetting section after saving it like

config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
Rahul
  • 76,197
  • 13
  • 71
  • 125