Web.config配置文件的自定义配置节点
web.config
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<configSections>
<section name="integration" type="System.Configuration.NameValueSectionHandler"/>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<integration configSource="integration.config">
天际配置节点
<?xml version="1.0" encoding="utf-8" ?>
<integration>
<add key="beijing" value="123"></add>
<add key="tianjin" value="123"></add>
</integration>
使用
.css
NameValueCollection users = System.Configuration.ConfigurationManager.GetSection("integration") as NameValueCollection;
string aa = integration["beijing"];
Response.Write(users.Keys[0] + "</br>" + users.Keys[1]);