The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

How to: Set the Default Time-Based Cache Policy for an Application 

The default time-based cache policy allows an application to have its cache behavior defined by the headers sent with the cached resource and the cache behavior defined in sections 13 and 14 of RFC 2616, available at This is the appropriate cache behavior for most applications.

To set the default automatic policy for an application

  1. Create a default time-based policy object.

  2. Set the policy object as the default for the application domain.


The two examples in this section produce identical policies.

The following example creates a default time-based policy and sets it as the default for the application domain.

public static void SetDefaultTimeBasedPolicy ()
    HttpRequestCachePolicy policy = new HttpRequestCachePolicy ();
    HttpWebRequest.DefaultCachePolicy = policy ;

You can also create the default time-based cache policy using the RequestCachePolicy class as shown in the following example:

public static void SetDefaultTimeBasedPolicy2()
    RequestCachePolicy policy = new RequestCachePolicy ();
    HttpWebRequest.DefaultCachePolicy = policy ;

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft