DefaultDocumentSection Class1
指定默认情况下要用于客户端的网页文件名。
语法
class DefaultDocumentSection : ConfigurationSectionWithCollection
方法
下表列出了 DefaultDocumentSection
类公开的方法。
名称 | 说明 |
---|---|
添加 | (继承自 ConfigurationSectionWithCollection。) |
清除 | (从 ConfigurationSectionWithCollection 继承。) |
Get | (从 ConfigurationSectionWithCollection 继承。) |
GetAllowDefinition | (继承自 ConfigurationSection。) |
GetAllowLocation | (从 ConfigurationSection 继承。) |
删除 | (从 ConfigurationSectionWithCollection 继承。) |
RevertToParent | (从 ConfigurationSection 继承。) |
SetAllowDefinition | (从 ConfigurationSection 继承。) |
SetAllowLocation | (从 ConfigurationSection 继承。) |
属性
下表列出了 DefaultDocumentSection
类公开的属性。
名称 | 描述 |
---|---|
Enabled |
一个读/写 boolean 值。 如果默认情况下将 Files 属性中指定的文件返回给客户端,则为 true ;否则为 false 。 默认为 true 。 |
Files |
一个 FileSettings 值,其中包含网络服务器默认返回给客户端的文件名称。 |
Location |
(继承自 ConfigurationSection 。)一个键属性。 |
Path |
(继承自 ConfigurationSection 。)一个键属性。 |
SectionInformation |
(从 ConfigurationSection 继承。) |
子类
此类不包含子类。
注解
此类对应于 ApplicationHost.config 文件中的 <defaultDocument>
部分。
示例
以下示例列出了默认网站的默认文档。
' 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
要求
类型 | 描述 |
---|---|
客户端 | - 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 |