Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERR_CACHE_MISS when navigating back to an ASPX page

I have a WebForms application where the first page is basically a grid containing links to a second page which loads up a PDF viewer. The grid is actually located in a .ascx control. Everything is working going from the first page to the PDF viewer page. However, when I hit the back button to return to the first page. I get the following error (in Chrome, but also this is happening in other browsers):

Cache miss error

If I click the back button then the browser returns to the first page and everything is fine, but I need to resolve this error.

I have tried disabling the cache in the first page based on the recommendation from this StackOverflow answer, like so:

Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0.
Response.AppendHeader("Expires", "0"); // Proxies.

I have also tried this:

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Cache.SetExpires(DateTime.MinValue);

I've placed this code in the code behind of the .aspx page and in the .ascx control (in the OnInit methods), all to no avail. What am I missing here?

like image 372
FishBasketGordo Avatar asked May 14 '15 22:05

FishBasketGordo


People also ask

What causes ERR_CACHE_MISS?

The ERR_CACHE_MISS error is usually caused by a problem with the caching system, outdated extensions, or the wrong browser configuration. Usually, the issue is with your own browser or with a third party extension. As such, updating or resetting your browser or disabling extensions will usually fix the problem.


1 Answers

As @JJS implied it sounds like you are using a OnClick (possible via LinkButton or ImageButton) which is causing a partial/full postback and your redirect is occurring in the code-behind. If this is correct, is there a reason why you are not using HyperLinks?

Cache handling is not the fix. The browser is stating a post occurred between pages.

like image 78
Drytin Avatar answered Oct 07 '22 01:10

Drytin