Share via


ModulesSection Class [IIS 7 and higher]

Represents the modules section in a configuration file.

Syntax

class ModulesSection : ConfigurationSectionWithCollection

Methods

The following table lists the methods exposed by the ModulesSection class.

Name

Description

Add

(Inherited from ConfigurationSectionWithCollection.)

Clear

(Inherited from ConfigurationSectionWithCollection.)

Get

(Inherited from ConfigurationSectionWithCollection.)

GetAllowDefinition

(Inherited from ConfigurationSection.)

GetAllowLocation

(Inherited from ConfigurationSection.)

Remove

(Inherited from ConfigurationSectionWithCollection.)

RevertToParent

(Inherited from ConfigurationSection.)

SetAllowDefinition

(Inherited from ConfigurationSection.)

SetAllowLocation

(Inherited from ConfigurationSection.)

Properties

The following table lists the properties exposed by the ModulesSection class.

Name

Description

Location

(Inherited from ConfigurationSection.) A key property.

Modules

An array of read/write ModuleAction values.

Path

(Inherited from ConfigurationSection.) A key property.

RunAllManagedModulesForAllRequests

A read/write boolean value. true if all managed modules are run for every request; otherwise, false. The default is false.

SectionInformation

(Inherited from ConfigurationSection.)

Subclasses

This class contains no subclasses.

Remarks

This class contains global modules that are enabled at a particular level on a Web server, and managed modules that also perform request work at the same level.

Example

The following example displays the native and managed modules in the <modules> section of the ApplicationHost.config file.

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

' Get the <modules> section.
Set oSection = oWebAdmin.Get( _
    "ModulesSection.Path='MACHINE/WEBROOT/APPHOST/',Location=''")

' Display the native modules.
WScript.Echo "---------- Native -------------"
For Each oModule In oSection.Modules
    If oModule.Type = "" Then
        WScript.Echo "   " & oModule.Name
    End If
Next
WScript.Echo 

' Display the managed modules.
WScript.Echo "---------- Managed ----------"
For Each oModule In oSection.Modules
    If oModule.Type <> "" Then
        If Len(oModule.Name) < 12 Then
            WScript.Echo "   " & oModule.Name & _
                vbTab & vbTab & vbTab & "[" & oModule.Type & "]"
        ElseIf Len(oModule.Name) < 20 Then
            WScript.Echo "   " & oModule.Name & _
                vbTab & vbTab & "[" & oModule.Type & "]"
        Else 
            WScript.Echo "   " & oModule.Name & _
                vbTab & "[" & oModule.Type & "]"
        End If
    End If
Next

Inheritance Hierarchy

ConfigurationSection

   ConfigurationSectionWithCollection

      ModulesSection

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

ConfigurationSectionWithCollection Class [IIS 7 and higher]

GlobalModuleElement Class [IIS 7 and higher]

GlobalModulesSection Class [IIS 7 and higher]

ModuleAction Class [IIS 7 and higher]