ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 149
نمايش فراداده

HttpCacheVaryByHeaders

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

This class is used to set the VaryByHeaders property of the HttpCachePolicy class. It allows you to specify that separate versions of a page should be cached for different languages or character sets. For example, if you set the UserCharSet property of this class to True, the "Accept-Charset" field will be included in the HTTP Vary header and a separate version of the page will be cached for each request that has a different character set. The cache page will be reused only among requests that have the same Accept-Charset header.

Alternatively, if type safety is not important, you can set the default Item property to a string that contains the name of a header, or a list of header names separated by semi-colons (;). Cached pages will then be reused only among requests that have the same values for the headers you identify.

public sealed class 

HttpCacheVaryByHeaders { // Public Instance Properties public bool

AcceptTypes {set; get; } public bool

this [string

header ]{set; get; } public bool

UserAgent {set; get; } public bool

UserCharSet {set; get; } public bool

UserLanguage {set; get; } // Public Instance Methods public void

VaryByUnspecifiedParameters ( ); }

Returned By

HttpCachePolicy.VaryByHeaders