下面的代码示例是 Machine.config 文件的一部分。配置节处理程序是为 system.web 节组和 anonymousIdentification 节声明的。在该声明下,声明了 system.Web 和 anonymousIdentification 配置元素。
system.Web 配置元素是配置节组的成员,这意味着它不包含任何属性。
anonymousIdentification 配置元素是配置节的成员,因此它继承上表列出的属性。请注意,它的 configSource 属性为它分配了一个外部文件(用于包含元素的内容),并且它的 lockItem 属性设置为 true 以防止对它的内容进行更改。
<configuration>
<configSections>
<!-- Other configuration sections. -->
<sectionGroup name="system.web" ...>
<section name="anonymousIdentification" ... />
</sectionGroup>
</configSections>
<system.web>
<anonymousIdentification configSource="IDSourceFile.xml"
lockItem="true" />
</system.web>
</configuration>