asp.net.ph

HttpCachePolicy.SetCacheability Method ( HttpCacheability, String )

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
);

Parameters

cacheability
The HttpCacheability enumeration value to set the header to.
field
The cache control extension to add to the header.

Exceptions


Exception Type Condition
ArgumentNullException Occurs when field is a null reference ( Nothing in Visual Basic ).
ArgumentException Occurs when cacheability is not Private or NoCache.

Remarks

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.

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.

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

See Also

HttpCachePolicy Members   HttpCachePolicy.SetCacheability Overload List Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph