asp.net c# web.config 读取web.config中自定义的参数信息,configuration section configSections
2013-03-11 16:07
736 查看
<configuration> <configSections> <sectionGroup name="" type=""> </sectionGroup> </sectionGroup> <!--自定义配直web.config参数--> <section name="mySection" type="System.Configuration.SingleTagSectionHandler" /> <!--自定义配直web.config参数--> </configSections> <!--自定义配直web.config参数--> <mySection section1 ="one" section2="two" section3="three" section4="four" /> <!--自定义配直web.config参数--> <appSettings> <add key="" value="" /> </appSettings> <connectionStrings/> </configuration>
using System; using System.Collections; using System.Configuration; public class ReaderConfiguration { /// <summary> /// 读取web.config中自定义参数值 /// </summary> /// <returns>String</returns> public String ReadMySettings() { IDictionary mySettings = (IDictionary)ConfigurationSettings.GetConfig("mySetting"); string section1 = (string)sampleTable["section1"]; string section2 = (string)sampleTable["section2"]; string section3 = (string)sampleTable["section3"]; string section4 = (string)sampleTable["section4"]; return section1 + "," + section2 + "," + section3 + "," + section4 ; } }
相关文章推荐
- ASP.NET、WinForm、C# - 配置文件信息读取 [ Web.config || Appconfig ]
- Customize web.config sections and register your own configuration then get values in asp.net
- ASP.NET自定义Web.config中的Section
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作,无法为请求的 Configuration 对象创建配置文件。
- 关于ASP.NET C#配置Web.config的方法及读取方法
- Asp.net中读取web.config参数的方法
- asp.net web.config 自定义错误信息
- ASP.NET读取设置Web.config文件
- asp.net 从Web.config 传递参数到后台
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作
- web.config configSections自定义section
- asp.net 在webconfig里自定义错误页
- 关于C#和ASP.NET中对App.config和Web.config文件里的[appSettings]和[connectionStrings]节点进行新增、修改、删除和读取相关的操作
- ASP.NET C# 的Web.config文件详细介绍
- C# asp.net IIS 在web.config和IIS中设置Session过期时间
- spring.net 代替configuremanager读取web.config文件中的配置信息
- asp.net读取Web.config的<appSettings></appSettings>
- C# asp.net IIS 在web.config和IIS中设置Session过期时间
- asp.net C# config 自定义节点及自定义节点配置以独立文件存在
- 关于asp.net(c#),webconfig中如何定义一个字符串让所有页面共同使用?