This documentation is archived and is not being maintained.
HttpResponse.Cache Property
.NET Framework 1.1
Gets the caching policy (expiration time, privacy, vary clauses) of a Web page.
[Visual Basic] Public ReadOnly Property Cache As HttpCachePolicy [C#] public HttpCachePolicy Cache {get;} [C++] public: __property HttpCachePolicy* get_Cache(); [JScript] public function get Cache() : HttpCachePolicy;
Property Value
An HttpCachePolicy object containing information about the caching policy of the current response.
Example
The following example writes properties of the current cache policy to the HTTP output stream.
[Visual Basic] Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)) Response.Cache.SetCacheability(HttpCacheability.Public) Response.Cache.SetValidUntilExpires(False) Response.Cache.VaryByParams("Category") = True If Response.Cache.VaryByParams("Category") Then '... End If [C#] Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); Response.Cache.SetCacheability(HttpCacheability.Public); Response.Cache.SetValidUntilExpires(false); Response.Cache.VaryByParams["Category"] = true; if (Response.Cache.VaryByParams["Category"]) { //... } [C++] Response->Cache->SetExpires(DateTime::Now.AddSeconds(60)); Response->Cache->SetCacheability(HttpCacheability::Public); Response->Cache->SetValidUntilExpires(false); Response->Cache->VaryByParams->Item[S"Category"] = true; if (Response->Cache->VaryByParams->Item[S"Category"]) { //... } [JScript] Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)) Response.Cache.SetCacheability(HttpCacheability.Public) Response.Cache.SetValidUntilExpires(false) Response.Cache.VaryByParams("Category") = true if(Response.Cache.VaryByParams("Category")){ //... }
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
HttpResponse Class | HttpResponse Members | System.Web Namespace
Show: