This documentation is archived and is not being maintained.

HttpCachePolicy.SetCacheability Method

Sets the Cache-Control HTTP header. The Cache-Control HTTP header controls how documents are to be cached on the network.

Overload List

Sets the Cache-Control header to one of the values of HttpCacheability.

[Visual Basic] Overloads Public Sub SetCacheability(HttpCacheability)
[C#] public void SetCacheability(HttpCacheability);
[C++] public: void SetCacheability(HttpCacheability);
[JScript] public function SetCacheability(HttpCacheability);

Sets the Cache-Control header to one of the values of HttpCacheability and appends an extension to the directive.

[Visual Basic] Overloads Public Sub SetCacheability(HttpCacheability, String)
[C#] public void SetCacheability(HttpCacheability, string);
[C++] public: void SetCacheability(HttpCacheability, String*);
[JScript] public function SetCacheability(HttpCacheability, String);

Example

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.

[Visual Basic] 
Response.Cache.SetCacheability(HttpCacheability.Private, "Community=DEV")
 

[C#] 
Response.Cache.SetCacheability(HttpCacheability.Private, "Community=DEV");
 

[C++] 
Response->Cache->SetCacheability(HttpCacheability::Private, S"Community=DEV");
 

[JScript] 
Response.Cache.SetCacheability(HttpCacheability.Private, "Community=DEV")
 

See Also

HttpCachePolicy Class | HttpCachePolicy Members | System.Web Namespace

Show: