More Group Sites
Education Books
School Rankings
Jobless Net
Better Home
Enviro++
更好教育论坛


Help | Subscribe/Unsubscribe | Rules | Other Group Sites: Better Education | Better Education Forum
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
View
Go to last post Go to first unread
hong  
#1 Posted : Sunday, 26 February 2017 4:49:32 PM(UTC)
hong

Rank: Administration

Reputation:

Groups: AcademicCoachingSchool, admin, Administration, BookSeller, CatholicSchool, CoachingAdult, CoachingProfessional, CoachingSports, ExtraCurriculumCoaching, IndependentSchool, Moderator, MusicTeacher, PrivateSchool, PublicSchool, SelectiveSchool, tutor
Joined: 23/11/2008(UTC)
Posts: 520

How to disable caching on an asp.net page

How to prevents server-side caching and browser caching?

The NoStore property is used to inform proxy servers and browser that they should not store a permanent copy of the cached content by setting Cache-Control: no-store within the request header.



1. caching control on an asp.net web form page

Code:
<%@ OutputCache NoStore="True" Duration="1" VaryByParam='*' Location="None" %> 

The 'duration' attribute must be set to a positive integer value. So 1 is used here.

It creates the following cache-header:

Cache-Control: no-cache, no-store
Pragma: no-cache
Expires: -1

This prevents caching by all means.

http://stackoverflow.com...on-multiple-syntax-to-pr
http://stackoverflow.com...l-max-age-0-and-no-cache

2. Disable browser cache for an ASP.NET MVC application
Code:
public class SomeController:Controller
{

  [OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]
  public ActionResult NoCache()
  {
    return View();
  }

}


http://bartwullems.blogs...ache-for-aspnet-mvc.html

3. Force page refreshing in code behind
Code:
Response.Redirect("ViewCart.aspx?id=" + DateTime.Now.Ticks.ToString());


4. Ensure that JQuery isn't caching the results
On your ajax methods:

Code:
$.ajax({
    cache: false
    //rest of your ajax setup
});


http://stackoverflow.com...tions-using-an-attribute
https://juristr.com/blog...t-caching-in-aspnet-mvc/

Edited by user Sunday, 26 February 2017 5:04:06 PM(UTC)  | Reason: Not specified

Sponsor
Rss Feed  Atom Feed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.