This documentation is archived and is not being maintained.

HttpCacheAgeControl Enumeration

Specifies the meaning of time values that control caching behavior for resources obtained using HttpWebRequest objects.

Namespace:  System.Net.Cache
Assembly:  System (in System.dll)

public enum HttpCacheAgeControl

Member nameDescription
NoneFor internal use only. The Framework will throw an ArgumentException if you try to use this member.
MinFreshContent can be taken from the cache if the time remaining before expiration is greater than or equal to the time specified with this value.
MaxAgeContent can be taken from the cache until it is older than the age specified with this value.
MaxStaleContent can be taken from the cache after it has expired, until the time specified with this value elapses.
MaxAgeAndMinFreshMaxAge and MinFresh.
MaxAgeAndMaxStaleMaxAge and MaxStale.

This enumeration is used by members of the HttpRequestCachePolicy class to configure the time values for cache policies.

The following code example creates a policy based on MaxAgeAndMinFresh.


public static HttpRequestCachePolicy CreateFreshAndAgePolicy(TimeSpan freshMinimum, TimeSpan ageMaximum)
{
    HttpRequestCachePolicy policy = 
        new HttpRequestCachePolicy(HttpCacheAgeControl.MaxAgeAndMinFresh, ageMaximum, freshMinimum); 
    Console.WriteLine(policy.ToString());
    return policy; 
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: