CacheSection.DisableExpiration Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets a value indicating whether the cache expiration is disabled.

Namespace:   System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)

[ConfigurationPropertyAttribute("disableExpiration", DefaultValue = false)]
public bool DisableExpiration { get; set; }

Property Value

Type: System.Boolean

true if the cache expiration is disabled; otherwise, false. The default is false.

If the DisableExpiration property is set to true, the cached items never expire. This setting is intended to help debug cache behavior in application code. Use caution when disabling cache expiration, as this might result in items being cached longer than they are valid.

System_CAPS_noteNote

To add a page to the output cache, you must establish an expiration policy for that page. You can do this declaratively with the @ OutputCache directive or programmatically using the SetExpires method. For more information, see How to: Set Expiration Values for ASP.NET Page Caching.

The following code example shows how to use the DisableExpiration property.

// Enable or disable cache expiration.
cacheSection.DisableExpiration =
    !cacheSection.DisableExpiration;

.NET Framework
Available since 2.0
Return to top
Show: