OutputCacheSettingsSection 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
配置應用程式頁面的輸出快取設定。 此類別無法獲得繼承。
public ref class OutputCacheSettingsSection sealed : System::Configuration::ConfigurationSection
public sealed class OutputCacheSettingsSection : System.Configuration.ConfigurationSection
type OutputCacheSettingsSection = class
inherit ConfigurationSection
Public NotInheritable Class OutputCacheSettingsSection
Inherits ConfigurationSection
- 繼承
範例
以下程式碼範例說明如何從現有網頁應用程式的設定檔取得該 OutputCacheSettingsSection 物件。
// Get the Web application configuration.
System.Configuration.Configuration webConfig =
WebConfigurationManager.OpenWebConfiguration("/aspnetTest");
// Get the section.
string configPath =
"system.web/caching/outputCacheSettings";
System.Web.Configuration.OutputCacheSettingsSection outputCacheSettings =
(System.Web.Configuration.OutputCacheSettingsSection)webConfig.GetSection(
configPath);
' Get the Web application configuration.
Dim webConfig _
As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/aspnetTest")
' Get the section.
Dim configPath As String = _
"system.web/caching/outputCacheSettings"
Dim outputCacheSettings _
As System.Web.Configuration.OutputCacheSettingsSection = _
CType(webConfig.GetSection(configPath), _
System.Web.Configuration.OutputCacheSettingsSection)
備註
這個 OutputCacheSettingsSection 類別允許你在設定檔中以程式方式存取並修改 outputCacheSettings 該 caching 區段的元素。 輸出快取設定定義了輸出快取中使用的相依關係(快取中儲存的項目與檔案、快取鍵或 CacheDependency 物件之間的關係),例如透過 @ OutputCache 指令或 OutputCacheProfile。
Note
可以 OutputCacheSettingsSection 根據區段屬性所定義的限制,將資訊寫入設定檔的相關區段,該屬性 AllowDefinition 的值為 MachineToApplication。 任何嘗試在階層結構中不允許的層級寫入設定檔,解析器都會產生錯誤訊息。 不過,你可以用這個類別讀取階層中任何層級的設定資訊。
建構函式
| 名稱 | Description |
|---|---|
| OutputCacheSettingsSection() |
初始化 OutputCacheSettingsSection 類別的新執行個體。 |