mercoledì 20 marzo 2013

Update App.Config Programmatically




ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = @"YourAppFile.exe.config";

Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);

AppSettingsSection app = config.AppSettings;

app.Settings.Remove("key ");
app.Settings.Add("key", "value");

config.Save(ConfigurationSaveMode.Modified);

Nessun commento:

Posta un commento