Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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)

public bool DisableExpiration { get; set; }
/** @property */
public boolean get_DisableExpiration ()

/** @property */
public void set_DisableExpiration (boolean value)

public function get DisableExpiration () : boolean

public function set DisableExpiration (value : boolean)

Not applicable.

Property Value

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 Expirations for Page Caching.

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


// Get the current DisableExpiration property value.
Boolean disableExpirationValue = 
    cacheSection.DisableExpiration;

// Set the DisableExpiration property to false.
cacheSection.DisableExpiration = false;
        

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2015 Microsoft