How to change the key value present in web config dynamically
Suppose there is a key present in web config and which have the value 10.
Example:
<add key="Unit" value="10" />
You can modify the value programmatically using this code
Code Behind :
Configuration webConfigApp = WebConfigurationManager.OpenWebConfiguration("~");
webConfigApp.AppSettings.Settings["Unit"].Value = "15";
webConfigApp.Save();
Namespace Required:
using System.Configuration; using System.Web.Configuration;
Comments
Post a Comment