惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
爱范儿
爱范儿
人人都是产品经理
人人都是产品经理
博客园 - 司徒正美
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
量子位
罗磊的独立博客
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
小众软件
小众软件
C
Cybersecurity and Infrastructure Security Agency CISA
Cyberwarzone
Cyberwarzone
大猫的无限游戏
大猫的无限游戏
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
Simon Willison's Weblog
Simon Willison's Weblog
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园_首页
博客园 - 叶小钗
V
Vulnerabilities – Threatpost
T
The Exploit Database - CXSecurity.com
T
Tailwind CSS Blog
IT之家
IT之家
博客园 - 聂微东
Spread Privacy
Spread Privacy
V2EX - 技术
V2EX - 技术
S
Security Affairs
宝玉的分享
宝玉的分享
V
V2EX
C
Cisco Blogs
博客园 - Franky
美团技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
S
Securelist
J
Java Code Geeks
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
WordPress大学
WordPress大学
W
WeLiveSecurity
T
Threatpost
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志

博客园 - karoc

《重构-改善既有代码的设计》读书笔记 扩展GridView,增加单选按钮列 任务开始时间和完成时间 最大长度验证控件:MaxLengthValidator 又是关于AjaxControlToolkit的ModalPopup的问题 有个总结 使用svn的小插曲 开发小经验总结(不断更新) 今天发现一个VS2008中文版和英文版的差别 解决DocType引起AjaxTookit的ModulPopup显示异常问题的方法 Reporting Services 2005 常见问题解决方法(不断更新) 用VSTO开发Project插件心得 自定义MemberShipProvider和PersonalizationProvider使用WebParts实现个性化页面 瞎搞八搞,另类PageBase 改造Duwamish中的Configuration 直接用Response输出可以加批注的Excel C#控制Windows Messenger和Windows Live Messenger窗口发送消息 一个读取扩展名为xml的资源文件的方法 用C#+WMI实现获取w3wp进程对应的应用程序池
在线修改KeyValue配置节
karoc · 2008-06-30 · via 博客园 - karoc

web.config中有一些自定义keyvalue配置节,想要在线修改,找了半天没找到现成的,自己写了一个:

就是类似这样的配置节:

    <system.framework>        
        
<add key="SystemFramework.Tracing.Enabled" value="True" />
        
<add key="SystemFramework.Tracing.TraceLevel" value="4" />
    
</system.framework>

写了4个类:
配置项:NameValueConfigurationItem

NameValueConfigurationItem

配置项集合:NameValueConfigurationCollection

CodeNameValueConfigurationCollection

配置节处理类:NameValueConfigurationSection

NameValueConfigurationSection

具体配置节处理类:FrameworkConfiguration

FrameworkConfiguration

配置节处理配置:

<configSections>
    
<section name="system.framework" type="Framework.Configuration.FrameworkConfiguration, Framework" />
</configSections>

修改配置:

System.Configuration.Configuration config
                = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");

            Mars.Utility.Web.Configuration.NameValueConfigurationSection
                section =
                (Mars.Utility.Web.Configuration.NameValueConfigurationSection)
            config.GetSection("system.framework");

            section.Settings.Remove(_key);
            section.Settings.Add(new Mars.Utility.Web.Configuration.NameValueConfigurationItem(_key,TextBoxValue.Text));

            config.Save(ConfigurationSaveMode.Modified);