Reading:
string value = ConfigurationManager.AppSettings["Setting1"];
Writing:
System.Configuration.Configuration config =ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["Setting1"].Value = "3";
config.AppSettings.Settings["Setting2"].Value = "blabla";
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
When use configuration settings in your web.config you have tou use
WebConfigurationManager class.
No comments:
Post a Comment