Main Page

  Previous Section Next Section


System.Web (system.web.dll)sealed class

This class is used to set the VaryByParams property of the HttpCachePolicy class. By default, cached pages will be reused only for GET requests with identical query string arguments. However, if you supply an instance of an HttpCacheVaryByParams class, the parameters that you specify will be the only criteria that determine whether or not a cached page can be reused. For example, if you specify ProductID, a separate copy of the page's output will be cached every time ASP.NET receives a request for the page with a different ProductID value. You can also use the wildcard asterisk (*) to indicate that all variables will be used to determine whether a page should be cached. This technique is discouraged because it could lead to excesssive copies of the page being stored in the cache, which could cause ASP.NET to clear out other, more useful data.

To specify parameters, set the default item property to a string that contains the name of a variable or to a list of variable names separated by semi-colons (;). Cached pages will be reused among requests that have the same values for these variables (in either the query string or form POST collection). All other variables will be ignored and will not stop a cached page from being reused.

public sealed class HttpCacheVaryByParams {
// Public Instance Properties
   public bool IgnoreParams{set; get; }
   public bool this[string header]{set; get; }

Returned By


      Previous Section Next Section