Name

HttpCacheVaryByHeaders

Synopsis

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 NotInheritable Class HttpCacheVaryByHeaders
                  ' Public Instance Properties
   Public Property AcceptTypes As Boolean  
   Public Default Property Item(
        ByVal header As String) As Boolean  
   Public Property UserAgent As Boolean  
   Public Property UserCharSet As Boolean  
   Public Property UserLanguage As Boolean  
' Public Instance Methods
   Public Sub VaryByUnspecifiedParameters() 
End Class

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.