Disable caching on a specific Classic ASP page

6,329

This is more of a stackoverflow answer, but the following code at the top of your page should do it. This has to be before any HTML is sent to the user or it won't work.

<%
Response.Expires = 0
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
%>
Share:
6,329

Related videos on Youtube

David Brunelle
Author by

David Brunelle

A programmer, not much more to know about me :)

Updated on September 17, 2022

Comments

  • David Brunelle
    David Brunelle over 1 year

    Not sure if I really am on the right forum, but if not, just tell me. I have a page that is coded in Classic ASP which is used to send email. We are currently having a problem in which the page seem to be sent twice sometime. Upon checking, we found out that those who have this problem are coming from big organisation, so it was suggested that their server might cache the file for some reason.

    I would like to know, is there a way in HTML (or Classic ASP) to prevent that from happening? Or is it in IIS that we must set this up?

    Thanks,

  • MattB
    MattB about 14 years
    @David: I wouldn't necessarily say it was a truly SO question, because there are probably ways to do it from the server only - just the easiest way is through code.