Marcus
Marcus

Reputation: 5447

How do I set IE to not store anything in the cache during development/testing?

I'm creating an Asp.NET site and I'm testing it in IE. Sometimes when I change the code and refresh the page, the changes don't get "seen," and I have to clear the cache and private data in IE. Is there a way to turn off this caching browser-side just for development? I want the functionality there in production, but it's annoying while working on the site.

Upvotes: 0

Views: 1014

Answers (3)

jonezy
jonezy

Reputation: 1923

Also helps to change the browsing history setting in IE, Tools -> options -> General ->Browsing history settings -> change check for newer version of pages to everytime I visit the page

This will ensure that IE isn't caching anything and always asking for the latest from the server.

Upvotes: 2

Kelsey
Kelsey

Reputation: 47726

You could have your base page (or an individual page) that does the following:

 // Checks for debug mode
 if (HttpContext.Current.IsDebuggingEnabled)
 {
     Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
     Response.Cache.SetNoStore();
 }

Check for debug mode which you probably would have your app in for development and then disable caching at the response level. It's not a 100% solution but it should be enough for what you need.

Upvotes: 1

David
David

Reputation: 34543

Press Ctrl + F5 to refresh the page. That does a hard refresh and forces all of the resources to be downloaded again. The IE developer toolbar also has an option that lets you clear the cache.

Upvotes: 2

Related Questions