Share via


DefaultDocumentSection Class [IIS 7 and higher]

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

Syntax

class DefaultDocumentSection : ConfigurationSectionWithCollection

Methods

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

Properties

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

Subclasses

This class contains no subclasses.

Remarks

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

Example

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

Inheritance Hierarchy

ConfigurationSection

   ConfigurationSectionWithCollection

      DefaultDocumentSection

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]

FileSettings Class [IIS 7 and higher]

Site Class [IIS 7 and higher]