HttpRuntimeSection.EnableKernelOutputCache Property

Definition

Gets or sets a value that indicates whether output caching is enabled.

C#
[System.Configuration.ConfigurationProperty("enableKernelOutputCache", DefaultValue=true)]
public bool EnableKernelOutputCache { get; set; }

Property Value

true if output caching is enabled; otherwise, false. The default value is true.

Attributes

Examples

The following example shows how to use the EnableKernelOutputCache property.

C#
// Get the current EnableKernelOutputCache property value.
Response.Write("EnableKernelOutputCache: " +
  configSection.EnableKernelOutputCache + "<br>");

// Set the EnableKernelOutputCache property to true.
configSection.EnableKernelOutputCache = true;

Remarks

In order to cache a response, the following criteria need to be met:

  • Caching must be explicitly enabled by a page directive or by the caching API.

  • Caching must have an expiration policy so that the kernel knows when to discard it.

  • Caching cannot have any variable headers or parameters.

  • The request must not require any authentication.

Note

This property is relevant only when Internet Information Services (IIS) version 6.0 or later is installed.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also