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 )
Not applicable.
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")