I' trying to update key value from code behind and it seemed like web.config updated but value didn't saved. appSetting there is nothing special:
<appSettings>
<add key="Default" value="1.11"/>
<add key="Company" value="1.078"/>
<add key="Customer" value="1.1"/>
</appSettings>
Here is the code that must update appSettings key value:
Protected Sub btnSaveDefault_Click(sender As Object, e As System.EventArgs) Handles btnSaveDefault.Click
Dim config As Configuration = WebConfigurationManager.OpenWebConfiguration("/")
config.AppSettings.Settings.Item("Default").Value = tbDefault.Text
config.Save(ConfigurationSaveMode.Modified)
ConfigurationManager.RefreshSection("appSettings")
End Sub
hope this help ...
follow this link .. Getting error while changing Appsettings value in Web config from code behind
Well. I found solution myself. The problem was in the other piece of code. So each time on Page Load code giving me old value and If Page.IsPostBack fixed this issue.