NameValueCollection
获得配置文件的节点的简单办法如下:
<configuration>
<communityStarterKit>
<pagePaths>
<add key="basePage" value="/communityDefault.aspx" />
<add key="baseService" value="/communityService.asmx" />
</pagePaths>
</communityStarterKit>
</configuration>
别忘了把这句话放在<configuration>下面<communityStarterKit>
<pagePaths>
<add key="basePage" value="/communityDefault.aspx" />
<add key="baseService" value="/communityService.asmx" />
</pagePaths>
</communityStarterKit>
</configuration>
<configSections>
<section name="pagePaths" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<section name="pagePaths" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
public static string UrlBasePage
{
get
{
NameValueCollection nvc = (NameValueCollection)
ConfigurationSettings.GetConfig("communityStarterKit/pagePaths");
return AppPath + nvc[ "basePage" ];
}
}
{
get
{
NameValueCollection nvc = (NameValueCollection)
ConfigurationSettings.GetConfig("communityStarterKit/pagePaths");
return AppPath + nvc[ "basePage" ];
}
}