Поделиться через


Класс DefaultDocumentSection1

Указывает имена файлов веб-страниц, которые будут использоваться клиентами по умолчанию.

Синтаксис

class DefaultDocumentSection : ConfigurationSectionWithCollection  

Методы

В следующей таблице перечислены методы, предоставляемые классом DefaultDocumentSection .

Имя Описание
Добавление (Наследуется от ConfigurationSectionWithCollection.)
Очистить (Является наследником ConfigurationSectionWithCollection)
Get (Является наследником ConfigurationSectionWithCollection)
GetAllowDefinition (Наследуется от ConfigurationSection.)
GetAllowLocation (Является наследником ConfigurationSection)
Удалить (Является наследником ConfigurationSectionWithCollection)
RevertToParent (Является наследником ConfigurationSection)
SetAllowDefinition (Является наследником ConfigurationSection)
SetAllowLocation (Является наследником ConfigurationSection)

Свойства

В следующей таблице перечислены свойства, предоставляемые классом DefaultDocumentSection .

Имя Описание
Enabled Значение для чтения и записи boolean . true Значение , если файлы, указанные в свойстве Files , возвращаются клиентам по умолчанию; в противном случае — значение false. Значение по умолчанию — true.
Files Значение FileSettings , содержащее имена файлов, которые веб-сервер может возвращать клиентам по умолчанию.
Location (Наследуется от ConfigurationSection.) Свойство ключа.
Path (Наследуется от ConfigurationSection.) Свойство ключа.
SectionInformation (Является наследником ConfigurationSection)

используются подклассы ;

Этот класс не содержит подклассов.

Комментарии

Этот класс соответствует разделу <defaultDocument> в ApplicationHost.config.

Пример

В следующем примере перечислены документы по умолчанию для веб-сайта по умолчанию.

' 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  
  

Иерархия наследования

ConfigurationSection

ConfigurationSectionWithCollection

DefaultDocumentSection

Требования

Тип Описание
клиент — IIS 7.0 в Windows Vista
— IIS 7.5 в Windows 7
— IIS 8.0 в Windows 8
— IIS 10.0 в Windows 10
Сервер — IIS 7.0 в Windows Server 2008
— IIS 7.5 в Windows Server 2008 R2
— IIS 8.0 в Windows Server 2012
— IIS 8.5 в Windows Server 2012 R2
— IIS 10.0 в Windows Server 2016
Продукт — IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF-файл WebAdministration.mof

См. также:

Класс ConfigurationSectionWithCollection
Класс FileSettings
Класс сайта