NameValueCollection

获得配置文件的节点的简单办法如下:

<configuration>
   
    
<communityStarterKit>
       
        
<pagePaths>
            
<add key="basePage" value="/communityDefault.aspx" />
            
<add key="baseService" value="/communityService.asmx" />
        
</pagePaths>
     
</communityStarterKit>

</configuration>
   
别忘了把这句话放在<configuration>下面
<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" ];
            } 
        }

posted on 2007-04-26 15:40  Neo0820  阅读(628)  评论(0编辑  收藏  举报

导航