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 http://www.ietf.org. This is the appropriate cache behavior for most applications.
To set the default automatic policy for an application
Create a default time-based policy object.
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 Shared Sub SetDefaultTimeBasedPolicy () Dim policy = New HttpRequestCachePolicy () HttpWebRequest.DefaultCachePolicy = policy End Sub
You can also create the default time-based cache policy using the RequestCachePolicy class as shown in the following example: