Modify Web.config value at runtime

Posted by Joe Enos on June 01, 2021 · 1 min read

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