Click here to Skip to main content
Click here to Skip to main content

Classic ASP - Prevent Cache from being stored

, 30 Oct 2012
Rate this:
Please Sign up or sign in to vote.
Classic ASP - Prevent Cache from being stored

Introduction

You will find below the exact code you need in order to prevent cache from being stored. I am posting this in order to help everyone that would ever have the need doing it. I spent myself some hours this last saturday trying to do this trick. I saw many combinations from the same code everywhere in several forums but this is the only one that worked for me, as referenced below 

After filling a form, then going back to the previous page and then forward back again, the form is empty as expected. Nothing is stored in the browser's cache  

Using the code 

All you have to do is place it at the top of your ASP file 

Response.buffer=true
Response.Expires = -1
Response.ExpiresAbsolute = Now() -1 
Response.AddHeader "pragma", "no-store"
Response.AddHeader "cache-control","no-store, no-cache, must-revalidate"

Hope it helps.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

diegosendra
CEO Diego Sendra
Uruguay Uruguay
Diego Sendra is a South American software and web development company, based in Montevideo, Uruguay. We have over 20 years experience in software development and professional website design in technologies such as VB 6, VB.Net, ASP/ASP.NET, PHP, Ajax, XML, JSON, Zend framework, amongst others
 
We are a company strongly focused in the seeking of excellence and perfection. We are recognized for our warm and personalised attention towards our customers, we always look for the easiest way to shed light on the usually complex software and web development related technical issues, specially during initial customer requirements understanding and data-collection stages
 
Diego Sendra owns customers worldwide: United States, Barbados, Spain, Italy, Sweden, United Kingdom, Turkey, India, Israel, Germany and places so distant from our main operation center, such as Malaysia, Singapore, Pakistan amongst others
 
We are database experts, bearing years of knowledge and experience in the field. Solid experience in SQL Server and MySQL databases
 
Our wide range of dynamic, strongly database-oriented developed websites, makes us experts in the field. Every creation delivered by us includes a robust backend module that allows you managing each and every module of your website, through a friendly user interface
 
Experts in e-commerce and B2B, we have wide experience integrating Paypal, Authorize.net, 2checkout and other credit-card payment processing gateways in our websites
 
We also specialize in data-mining software and web scraping. Yellow pages, forums, classified sites, directories and others are some of the areas we've developed crawlers for. We have developed a web scraping engine, which is the core of our applications. CSV export feature, user-defined scraping speed functionality to mimic human browsing, URL scraping support and other features
 
We kindly invite you to see our portfolio of products & services
 
Sincerely,
 
Diego Sendra
CEO
 
Diego Sendra
Software Development

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 30 Oct 2012
Article Copyright 2012 by diegosendra
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid