首页 | 新闻 | 网站建设 | 成功案例 | 服务项目 | 商业购买 | 编程技术 | 壁纸 | 休闲娱乐 | 下载专区 | 留言 | 论坛
 
您现在的位置:网站首页 > 编程技术 > ASP.NET
c# 读写web.config配置文件的方法
发布时间:2008-01-26  发布:奇景  关键字:c# web.config 配置  阅读次数:662  【字号
public static void writeConfig(string item, string key, string value)
{
if (item == "")
{
item = "appSettings";
}
Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(System.Web.HttpContext.Current.Request.ApplicationPath);
AppSettingsSection appSection = (AppSettingsSection)config.GetSection(item);
if (appSection.Settings[key] == null)
{
appSection.Settings.Add(key, value);
config.Save();
}
else
{
appSection.Settings.Remove(key);
appSection.Settings.Add(key, value);
config.Save();
}
}

【收藏此页】【复制网址】【打印】【关闭】返回上一级
 ≡相关主题≡
 
分类导航
本类最新
本周热门

  版权声明 | 关于本站 | 常见问题 | 联系我们 | 网站管理 | 页面顶端
CopyRight ? QScms.cn All Rights Reserved 福州帝威荣信息技术有限公司研发 业务联系:0591-87522535
互联网许可证:闽ICP备08002627号 QQ:812188106 邮箱:qscms@yahoo.cn
Power By QsCMS V3.0  执行时间 : 0.000 秒 页面装载: