Export (0) Print
Expand All
Expand Minimize

DefaultDocumentSection Class [IIS 7 and higher]

IIS 7.0

Specifies the Web page file names to serve to clients by default.

class DefaultDocumentSection : ConfigurationSectionWithCollection

The following table lists the methods exposed by the DefaultDocumentSection 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 DefaultDocumentSection class.

Name

Description

Enabled

A read/write boolean value. true if the files specified in the Files property are returned to clients by default; otherwise, false. The default is true.

Files

A FileSettings value that contains the names of the files that the Web server may return to clients by default.

Location

(Inherited from ConfigurationSection.) A key property.

Path

(Inherited from ConfigurationSection.) A key property.

SectionInformation

(Inherited from ConfigurationSection.)

This class contains no subclasses.

This class corresponds to the <defaultDocument> section in ApplicationHost.config.

The following example lists the default documents for the default Web site.

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

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

' Retrieve the default document section by using the GetSection method.
oSite.GetSection "DefaultDocumentSection", oDefaultDocumentSection

' List the path and show whether the default document section is enabled.
WScript.Echo "Path: " & oDefaultDocumentSection.Path
WScript.Echo 
WScript.Echo "Default Document Section Enabled: " & oDefaultDocumentSection.Enabled
WScript.Echo 

' List the default document file names.
WScript.Echo "[Default Document File List]"
For Each oFile In oDefaultDocumentSection.Files.Files
        WScript.Echo oFile.Value
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:
© 2015 Microsoft