[原创]自定义Config例子,使用IConfigurationSectionHandler 接口
2007-03-12 22:20
519 查看
1.MasterPage
调用方法
private void GetConfig()
2.CooperationChannelsConfig :
//实现一个类支持IConfigurationSectionHandler 接口来对自定义节进行处理,完成对自定义节的读取
namespace Config
3.在项目中建立一个Global文件,在Application_Start()事件中增加一句话取得GetSection:
System.Configuration.ConfigurationManager.GetSection("channel");
4.在Web.config中配置一下mapping类和只明使用的自定义的config文件:
<section name="channel" type="Config.CooperationChannelsConfig, Config " />
<channel configSource="Config\\Channel.config"/>
5.Channel.config: 自定义的Config文件
<?xml version="1.0" encoding="gb2312"?>
<channel>
<add key="Key" value="value"/>
<add key="Key1" value="value1"/>
</channel>
最后我也提供一下MSDN上面的自定义配置节的例子:
ms-help://MS.MSDNQTR.v80.chs/MS.MSDN.v80/MS.VisualStudio.v80.chs/dv_aspnetconfig/html/07f68a3f-2920-4665-a824-47bda744e662.htm
调用方法
private void GetConfig()
2.CooperationChannelsConfig :
//实现一个类支持IConfigurationSectionHandler 接口来对自定义节进行处理,完成对自定义节的读取
namespace Config
3.在项目中建立一个Global文件,在Application_Start()事件中增加一句话取得GetSection:
System.Configuration.ConfigurationManager.GetSection("channel");
4.在Web.config中配置一下mapping类和只明使用的自定义的config文件:
<section name="channel" type="Config.CooperationChannelsConfig, Config " />
<channel configSource="Config\\Channel.config"/>
5.Channel.config: 自定义的Config文件
<?xml version="1.0" encoding="gb2312"?>
<channel>
<add key="Key" value="value"/>
<add key="Key1" value="value1"/>
</channel>
最后我也提供一下MSDN上面的自定义配置节的例子:
ms-help://MS.MSDNQTR.v80.chs/MS.MSDN.v80/MS.VisualStudio.v80.chs/dv_aspnetconfig/html/07f68a3f-2920-4665-a824-47bda744e662.htm
相关文章推荐
- 使用IConfigurationSectionHandler在web.config中增加自定义配置
- 使用IConfigurationSectionHandler在web.config中增加自定义配置
- 使用IConfigurationSectionHandler在web.config中增加自定义配置
- 使用IConfigurationSectionHandler在web.config中增加自定义配置
- 使用IConfigurationSectionHandler在web.config中增加自定义配置
- 使用IConfigurationSectionHandler在web.config中增加自定义配置
- 使用IConfigurationSectionHandler在web.config中增加自定义配置
- 使用IConfigurationSectionHandler在web.config中增加自定义配置
- .Net——实现IConfigurationSectionHandler接口定义处理程序处理自定义节点
- (转).net webconfig使用IConfigurationSectionHandler自定section
- 实现IConfigurationSectionHandler接口来编写自定义配置
- ASP.NET 实践:使用 IConfigurationSectionHandler 创建自定义配置段
- .Net——实现IConfigurationSectionHandler接口定义处理程序处理自定义节点
- .Net——实现IConfigurationSectionHandler接口定义处理程序处理自定义节点
- [C#]DLL继承IConfigurationSectionHandler即可访问宿主的.exe.config
- 使用HandlerMethodArgumentResolver接口自定义Spring MVC的参数接受规则
- IConfigurationSectionHandler 接口
- IConfigurationSectionHandler 接口的实现
- 自定义App.config NameValueSectionHandler的bug修复创建自己的NameValueCollectionSectionHandler
- [C#]DLL继承IConfigurationSectionHandler即可访问宿主的.exe.config