DefaultDocumentSection Class1

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 - IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on Windows Server 2008
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF file WebAdministration.mof

See Also

ConfigurationSectionWithCollection Class
FileSettings Class
Site Class