Skip to content

Instantly share code, notes, and snippets.

@n3dst4
Created November 8, 2013 13:32
Show Gist options
  • Select an option

  • Save n3dst4/7371087 to your computer and use it in GitHub Desktop.

Select an option

Save n3dst4/7371087 to your computer and use it in GitHub Desktop.
Disabling absolutely all caching on an ASP.NET MVC controller action. Because this is always so much ballache.
Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
Response.Cache.SetValidUntilExpires(false);
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment