C#-webform动态改变Web.config的值

<appSettings> <add key="IsChangeDb" value="false"/> </appSettings>

 

//获取web.config中 定义在appSetting中定义的配置
var item = ConfigurationManager.AppSettings["UserId"];

 

Configuration config=System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
config.AppSettings.Settings.Remove("UserId");
config.AppSettings.Settings.Add("UserId", "TestData");
config.Save();

附件,登陆保存账号的方法

 


来源:CSDN
原文:https://blog.csdn.net/qq_32452623/article/details/53580093

 

 

 

 

 

 

 

内容来源于https://blog.csdn.net/qq_32452623/article/details/53580093

posted @ 2019-06-24 10:14  kuangx  阅读(373)  评论(0编辑  收藏  举报