public static void SetAppKey(string keyName, string keyValue)
{
Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(System.Web.HttpContext.Current.Request.ApplicationPath);
AppSettingsSection appSection = (AppSettingsSection)config.GetSection("appSettings");
if(appSection.Settings[keyName] != null)
appSection.Settings[keyName].Value = keyValue;
config.Save();
}asp.net写入web.config
最新推荐文章于 2018-09-13 11:00:22 发布
本文介绍了一段C#代码,该代码用于修改ASP.NET应用程序中Web.config文件的appSettings部分。通过使用这段代码,可以方便地更新指定的应用程序密钥。
88

被折叠的 条评论
为什么被折叠?



