Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CacheSection.DisableExpiration Property

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.

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;

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.