HttpCachePolicy.SetCacheability Method (HttpCacheability, String)
Assembly: System.Web (in system.web.dll)
public void SetCacheability ( HttpCacheability cacheability, String field )
public function SetCacheability ( cacheability : HttpCacheability, field : String )
Parameters
- cacheability
The HttpCacheability enumeration value to set the header to.
- field
The cache control extension to add to the header.
The field name extension is valid only when used with the private or no-cache directives. For more information, see RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1, available on the World Wide Web Consortium (W3C) Web site.
This method will throw an invalid argument exception if incompatible directives and extensions are combined.
The following code example demonstrates how the Cache-Control header is set to the enumeration value private and adds a cache-control extension. The modified directive means that in addition to any non-shared cache, any cache shared only by members of the community named "DEV" may cache the response.
get_Response().get_Cache().
SetCacheability(HttpCacheability.Private, "Community=DEV");
Response.Cache.SetCacheability(HttpCacheability.Private, "Community=DEV")
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.