ModulesSection Class [IIS 7 and higher]

IIS 7.0

Represents the modules section in a configuration file.

class ModulesSection : ConfigurationSectionWithCollection

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.)

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.)

This class contains no subclasses.

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.

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

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

Community Additions

ADD
Show: