Print Page | Close Window

Create a 3 day cache

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=31768
Printed Date: 29 November 2023 at 4:58am
Software Version: Web Wiz Forums 12.06 - https://www.webwizforums.com


Topic: Create a 3 day cache
Posted By: Roberto Randall
Subject: Create a 3 day cache
Date Posted: 24 June 2023 at 4:44pm
If I want to create a 3 day cache to put on a page, is this correct?

Response.Expires = 4320
Response.ExpiresAbsolute =  DateAdd("d", 3, Now())
Response.AddHeader "pragma","public"
Response.AddHeader "cache-control","public,max-age=259200"
Response.CacheControl = "public"


I am doing some tests for the images and I am not sure if this code is correct so that the page where I want to put it has a cache of 3 days.

Thank you.

-------------
https://www.lanocion.es - https://www.lanocion.games - https://www.lanocion.chat



Replies:
Posted By: WebWiz-Bruce
Date Posted: 25 June 2023 at 11:15am
This should work for the actual page itself, but for the images you will need to configure output caching through the websites web.config file.

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: Roberto Randall
Date Posted: 25 June 2023 at 12:42pm
Thanks for answering.

Searching the net I have read in Microsoft:


The Expires, https://learn.microsoft.com/en-us/dotnet/api/system.web.httpresponse.expiresabsolute?view=netframework-4.8.1" rel="nofollow - ExpiresAbsolute and https://learn.microsoft.com/en-us/dotnet/api/system.web.httpresponse.cachecontrol?view=netframework-4.8.1" rel="nofollow - CacheControl properties have been deprecated in favor of the methods of the https://learn.microsoft.com/en-us/dotnet/api/system.web.httpcachepolicy?view=netframework-4.8.1" rel="nofollow - HttpCachePolicy class available through the https://learn.microsoft.com/en-us/dotnet/api/system.web.httpresponse.cache?view=netframework-4.8.1" rel="nofollow - Cache intrinsic object to control the Internet Information Services (IIS) output cache and client caches.


It is that I am doing tests with AspJpeg from Persits and I have created an asp page that changes the size of the image by means of a string (ej,. image.asp?width=230&file=myphoto.jpg) and for that reason I have to put the cache in the page, because I don't know if assigning a cache to a jpg via web.config will also do it to the results of this page.


-------------
https://www.lanocion.es - https://www.lanocion.games - https://www.lanocion.chat



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.06 - https://www.webwizforums.com
Copyright ©2001-2023 Web Wiz Ltd. - https://www.webwiz.net