Adding app setting in web.config using c#


System.Configuration.
Configuration conf = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
int Cnt = System.Configuration.ConfigurationManager.AppSettings.Count;
string Key = "Name" + Cnt.ToString();
string Value = DateTime.Now.ToLongDateString() +
" " + DateTime.Now.ToLongTimeString();

conf.AppSettings.Settings.Add(Key, Value);

conf.Save(System.Configuration.
ConfigurationSaveMode.Modified);
Ebook Download
View all
Learn
View all