指定預設提供給用戶端的網頁檔案名。
Syntax
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值,其中包含 Web 服務器預設可能會傳回用戶端的檔案名。 |
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
繼承階層架構
ConfigurationSectionWithCollection
DefaultDocumentSection
規格需求
| 類型 | 描述 |
|---|---|
| Client | - Windows Vista 上的 IIS 7.0 - Windows 7 上的 IIS 7.5 - Windows 8 上的 IIS 8.0 - Windows 10上的 IIS 10.0 |
| 伺服器 | - Windows Server 2008 上的 IIS 7.0 - Windows Server 2008 R2 上的 IIS 7.5 - Windows Server 2012 上的 IIS 8.0 - Windows Server 2012 R2 上的 IIS 8.5 - Windows Server 2016上的 IIS 10.0 |
| 產品 | - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0 |
| MOF 檔案 | WebAdministration.mof |