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
- 继承
示例
下面的代码示例演示如何从现有 Web 应用程序的配置文件获取 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。
注意
OutputCacheSettingsSection可以根据值MachineToApplication为 的 section 属性AllowDefinition定义的限制,将信息写入配置文件的相关节。 在层次结构中不允许的级别在配置文件中写入的任何尝试都将导致分析程序生成的错误消息。 但是,可以使用此类读取层次结构中任何级别的配置信息。
构造函数
OutputCacheSettingsSection() |
初始化 OutputCacheSettingsSection 类的新实例。 |