• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 482
  • Last Modified:

Classic ASP pages Caching

Hello Experts,

I am having a problem where I think my pages are caching.

For example, I look at one page, navigate to another, then change the image in the file forlder and navigate to the first page. The original image is shown until I hit Refresh.

I have tried http://www.devx.com/vb2themax/Tip/18635 but  it did not work,

Secondly, I deleted the code from the previous URL and tried http://support.microsoft.com/default.aspx?scid=kb;en-us;332075 then restarted my machine and opened the same page where the old images appeared until I hit Refresh. Again, this was after restarting my machine, which contains both my IIS and my IE8.

Any ideas?
0
APD Toronto
Asked:
APD Toronto
  • 4
  • 3
  • 3
1 Solution
 
sammySeltzerCommented:
Just to understand you, are you trying to avoid users from going back to view a page *after* they have left that page?
0
 
APD TorontoAuthor Commented:
no, my goal is to prevent the page from cachiing.

When the user returns to the page, I want them to see the newest/freshest data.

0
 
sammySeltzerCommented:
Did you try disabling buffering?

Something like this:


   Response.Buffer = False
   Response.AddHeader "pragma","no-cache"
   Response.CacheControl = "no-cache"
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
sammySeltzerCommented:
Try these as well:

    pStr = "private, no-cache, must-revalidate"
    Response.ExpiresAbsolute = #2000-01-01#
    Response.AddHeader "pragma", "no-cache"
    Response.AddHeader "cache-control", pStr
   
   

http://classicasp.aspfaq.com/general/how-do-i-prevent-my-asp-pages-from-caching.html

http://www.developerfusion.com/code/1160/preventing-caching/
   

    If you find that you're still getting the old page, after clearing your browser's page and even deleting the file from the server, then IIS has it cached. You can clear this by going into the IIS Admin interface and unchecking "Cache ISAPI Applications", hitting apply, uploading the new file, and turning the setting back on.
0
 
APD TorontoAuthor Commented:
I tried your first 3 lines.

Should I delete those, and try your other 4, or should i try all 7 lines?
0
 
sammySeltzerCommented:
delete and try these new lines but before you do, please add this line and try again.

Response.Expires = -1

0
 
Abiel de GrootDeveloperCommented:
No of those will work as this is likely to be server caching.

Your best solution is a bit more basic, and insure the image url 'seems' different each time.

Try doing this to the image source...

--------------------------

<img src="yourImageFolder/yourImageName?<%=Now%> alt="<%=ArrShortCont(0,k)%>" border="0" class="Col_2b_IMG"/>

-------------------------

?<%=Now%> at the end of the image source ensures it is always different but will not affect the calling of the image.

Beest regards

A:
0
 
Abiel de GrootDeveloperCommented:


Sorry... that should be:

?<%=Now()%>

Not

?<%=Now%>
0
 
APD TorontoAuthor Commented:
simple and awesome!

thanks
0
 
Abiel de GrootDeveloperCommented:
You are welcome.

The solution often is.

Best regards

A.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now