Reputation: 11
How can I make the config.AppSettings.Add(key,value) to add new key on all boxes in a web farm Programmatically ?
Upvotes: 1
Views: 1442
Reputation: 496
Here's some code to add or update a key:
Dim cfg As System.Configuration.Configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(Configuration.ConfigurationUserLevel.None)
cfg.AppSettings.Settings.Remove(key) //Get rid of the existing value
cfg.AppSettings.Settings.Add(key, val)
cfg.Save(Configuration.ConfigurationSaveMode.Modified)
Upvotes: 2