SiteContainsConfigurationSection Class [IIS 7 and higher]

Provides a relationship between a Web site and its configuration sections.

Syntax

class SiteContainsConfigurationSection : ObjectConfigurationAssociation

Methods

This class contains no methods.

Properties

The following table lists the properties for the SiteContainsConfigurationSection class.

Name

Description

Container

A read-only Site object that represents an IIS Web site.

Element

A read-only ConfigurationSection object that exposes the configuration section for a Web site.

Subclasses

This class has no subclasses.

Remarks

Associations return only instances of the object that are defined at the level of the object. For example, if the <authentication> section is the only section defined in the Web.config file at the site level, only the AuthenticationSection instance of the ConfigurationSection object will be returned.

To get all available sections, you should use the GetAllSections method of the ConfiguredObject class.

Example

The following example lists all configuration sections that are defined at the Web.config level for the default Web site.

' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Get the default Web site.
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")

' List the configuration sections present in the Web.config file
' of the default Web site.
Set oSections = oSite.Associators_("SiteContainsConfigurationSection")
For Each oSection In oSections
    WScript.Echo oSection.Path_.Class
Next

Inheritance Hierarchy

ObjectConfigurationAssociation

   SiteContainsConfigurationSection

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

ConfiguredObject.GetAllSections Method [IIS 7 and higher]

ObjectConfigurationAssociation Class [IIS 7 and higher]

Site Class [IIS 7 and higher]

VirtualDirectoryContainsConfigurationSection Class [IIS 7 and higher]