Modify web.config appsettings value

Posted by Joe Enos on April 26, 2021 · 1 min read

var config = WebConfigurationManager.OpenWebConfiguration("~");
var section = (AppSettingsSection)config.GetSection("appSettings");
section.Settings["something"].Value = "newValue";
config.Save();