公開網站上的靜態內容的組態設定。
Syntax
class StaticContentSection : ConfigurationSectionWithCollection
方法
下表列出 類別所 StaticContentSection 公開的方法。
| 名稱 | 描述 |
|---|---|
| 加入 | (繼承自 ConfigurationSectionWithCollection.) |
| 清除 | (繼承自 ConfigurationSectionWithCollection。) |
| Get | (繼承自 ConfigurationSectionWithCollection。) |
| GetAllowDefinition | (繼承自 ConfigurationSection.) |
| GetAllowLocation | (繼承自 ConfigurationSection。) |
| 移除 | (繼承自 ConfigurationSectionWithCollection。) |
| RevertToParent | (繼承自 ConfigurationSection。) |
| SetAllowDefinition | (繼承自 ConfigurationSection。) |
| SetAllowLocation | (繼承自 ConfigurationSection。) |
屬性
下表列出 類別所 StaticContentSection 公開的屬性。
| 名稱 | 描述 |
|---|---|
ClientCache |
公開用戶端快取組態的讀取/寫入 HttpClientCache 值。 |
DefaultDocFooter |
讀取/寫入 string 值,其中包含網站上每個網頁的預設頁尾文字,或包含預設頁尾文字的檔案路徑。 這個屬性的讀取方式取決於屬性的 IsDocFooterFileName 設定。 預設值為 null。 |
EnableDocFooter |
讀取/寫入 boolean 值。 true 如果 所指示 DefaultDocFooter 的文字會出現在網站上的每一個靜態頁面上,則為 , false 否則為 。 預設值為 false。 |
IsDocFooterFileName |
讀取/寫入 boolean 值。 true 如果 中的 DefaultDocFooter 字串包含檔案的路徑,其中包含網站上每個靜態網頁的預設頁尾文字,則為 ,否則為 false 。 預設值為 false。 |
Location |
(繼承自 ConfigurationSection .) 索引鍵屬性。 |
Path |
(繼承自 ConfigurationSection .) 索引鍵屬性。 |
SectionInformation |
(繼承自 ConfigurationSection。) |
StaticContent |
讀取/寫入 MimeMapElement 物件的陣列,其中包含靜態內容的 MIME 對應。 |
子類別
這個類別不包含子類別。
備註
這個類別中的屬性會對應至ApplicationHost.config檔案區段中的屬性和元素 <staticContent> 。
範例
下列範例顯示 類別的 StaticContentSection 頁尾文字和用戶端快取屬性。
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
' Get the static content section.
Set oSection = oWebAdmin.Get("StaticContentSection.Path=" & _
"'MACHINE/WEBROOT/APPHOST',Location=''")
' Show the path and location.
WScript.Echo "Path: " & oSection.Path
WScript.Echo "Location: " & oSection.Location
WScript.Echo
'Show the doc-footer-related properties.
WScript.Echo "Doc Footer properties"
WScript.Echo "---------------------"
WScript.Echo "EnableDocFooter: " & oSection.EnableDocFooter
WScript.Echo "IsDocFooterFileName: " & oSection.IsDocFooterFileName
WScript.Echo "DefaultDocFooter: " & oSection.DefaultDocFooter
WScript.Echo
' Show the embedded client-cache properties.
Set oClientCache = oSection.ClientCache
WScript.Echo "ClientCache properties"
WScript.Echo "----------------------"
WScript.Echo "CacheControlCustom: " & _
oClientCache.CacheControlCustom
WScript.Echo "CacheControlMaxAge: " & _
oClientCache.CacheControlMaxAge
WScript.Echo "CacheControlMode: " & _
oClientCache.CacheControlMode
WScript.Echo "HttpExpires: " & _
oClientCache.HttpExpires
繼承階層架構
ConfigurationSectionWithCollection
StaticContentSection
規格需求
| 類型 | 描述 |
|---|---|
| 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 |
另請參閱
ConfigurationSection 類別
ConfigurationSectionWithCollection 類別
HttpClientCache 類別
MimeMapElement 類別