System.Web Namespace HttpCachePolicy Class
Sets the Cache-Control header to one of the values of HttpCacheability and appends an extension to the directive.
[ VB ]
Overloads Public Sub SetCacheability ( _
ByVal cacheability As HttpCacheability, _
ByVal field As String _
)
[ C# ]
public void SetCacheability (
HttpCacheability cacheability,
string field
);
[ C++ ]
public: void SetCacheability (
HttpCacheability cacheability,
String* field
);
[ JScript ]
public function SetCacheability (
cacheability : HttpCacheability,
field : String
);
- 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 the Hypertext Transfer Protocol ( HTTP/1.1 ) documentation, available from the World Wide Web Consortium.
This method will fail if cacheability violates the restrictiveness hierarchy. If incompatible directives and extensions are combined, this method will throw an invalid argument exception.
The following example sets the Cache-Control header 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.
Response.Cache.SetCacheability ( HttpCacheability.Private, "Community=DEV" );
Response.Cache.SetCacheability ( HttpCacheability.Private, "Community=DEV" ) |
|
C# |
VB |
HttpCachePolicy Members HttpCachePolicy.SetCacheability Overload List