cnforum自定义配置节

webconfig
<sectionGroup name="forums">
    
<section name="forums" type="AspNetForums.Configuration.ForumsConfigurationHandler, AspNetForums.Components" />
  
</sectionGroup>

<forums>
<forums>
</forums>
</forums>

处理程序

namespace AspNetForums.Configuration 
    
{
        
public class ForumConfiguration 
        

            
public static ForumConfiguration GetConfig() 
            
{
                
return (ForumConfiguration) ConfigurationSettings.GetConfig("forums/forums");
            }

    
            
internal void LoadValuesFromConfigurationXml(XmlNode node) {}
        }




        
internal class ForumsConfigurationHandler : IConfigurationSectionHandler 
        
{
            
public virtual object Create(Object parent, Object context, XmlNode node) 
            
{
                ForumConfiguration config 
= new ForumConfiguration();
                config.LoadValuesFromConfigurationXml(node);
                
return config;
            }


        }

    }
posted @ 2005-07-15 17:54  烈马狂生  阅读(256)  评论(0编辑  收藏  举报