OutPut Cache is the caching technique to cache the static pages in ASP.NET.
Questions tagged [outputcache]
680 questions
16
votes
3 answers
How to turn output caching off for authenticated users in ASP.NET MVC?
I have an ASP.NET MVC application. I need to cache some pages however only for non-authenticated users.
I've tried to use VaryByCustom="user" with the following GetVaryByCustomString implementation:
public override string…

Jakub Šturc
- 35,201
- 25
- 90
- 110
16
votes
3 answers
ASP.NET MVC: Problem with OutputCache
for my current project it's necessary to generate dynamic CSS...
So, i have a partial view which serves as a CSS deliverer... The controller code looks like this:
[OutputCache(CacheProfile = "DetailsCSS")]
public ActionResult…

David
- 2,551
- 3
- 34
- 62
14
votes
1 answer
ASP.Net MVC Output Caching: The directive or the configuration settings profile must specify the 'varyByParam' attribute
I encountered the above error message after applying the OutputCache attribute on ActionResult methods with no input parameters - why would I use VaryByParams in this case? Is this a bug in ASP.Net MVC or is there a way of using OutputCache without…

Zac Seth
- 2,742
- 5
- 37
- 56
14
votes
1 answer
How to invalidate Web API cache from another Controller(ASP.NET Web API CacheOutput Library)
I have used ASP.NET Web API CacheOutput Library for my asp.net project for web API and it working fine, but have another controller from where I have a POST method and I would like to invalidate my cache from that…

Suresh
- 1,131
- 1
- 15
- 28
14
votes
1 answer
Is it possible to use OutputCache on mvc JsonResult controller methods?
I am trying to do this, and it leads to result with contentlen 0
It looks like:
[OutputCache(Duration = 36000)]
public JsonResult GetFileClasses()
{
return this.Json(TopicConfig.FileExtensionsSettings.List)
}
Any ideas?

st78
- 8,028
- 11
- 49
- 68
14
votes
3 answers
How do I configure ASP.Net OutputCache to vary by http vs https?
Here is the scenario, a user opens up non-secure page from our WebApp, let's call it PageA, in their browser and then clicks a link in there that takes them to a secure instance of PageB. Once in PageB the user can subsequently click a link that…

James
- 12,636
- 12
- 67
- 104
13
votes
3 answers
ASP.Net Core 2.0 - ResponseCaching Middleware - Not Caching on Server
I want to use server-side response caching (output cache) with asp.net core 2.0 and found out about Response Caching Middleware and wanted to give it a try with a brand new asp.core mvc project.
Here is the description from the link above which…

Engin
- 385
- 1
- 4
- 15
13
votes
3 answers
How to set different Cache expire times for Client and Server caches
I would like to have certain pages have a 10 minute Cache for clients and 24 hours for the server. The reason is if the page changes, the client will fetch the updated version within 10 minutes, but if nothing changes the server will only have to…

Josh
- 8,219
- 13
- 76
- 123
13
votes
4 answers
Working with the Output Cache and other Action Filters
I have added Output Caching to a couple of actions in my app for some easy performance boosts. However, these actions also need to increment a counter after each request (it's a views counter) by hitting a Redis db.
At first, I figured I could just…

Dusda
- 3,347
- 5
- 37
- 58
12
votes
3 answers
Vary by control properties using PartialCaching in ASP.NET
I am using the PartialCaching attribute on the base class of a user control.
I would like the cached controls to vary based on the properties set on the control instance.
For example:

frankadelic
- 20,543
- 37
- 111
- 164
12
votes
1 answer
Post-cache substitution with Page.Render overriding
The context
I have an Asp .Net web application with some pages that inherit from a base class "BasePage".
This BasePage class inherits from System.Web.ui.Page and I've overriden the Render method so that I can intercept the HTML stream before it is…

Benjamin Simon
- 444
- 4
- 14
11
votes
3 answers
OutputCache is sending wrong Vary header when the call hits the cache
I have an action method that I want to cache:
[OutputCache(Duration=60*5, Location=OutputCacheLocation.Any, VaryByCustom="index")]
public ActionResult Index()
{
return View();
}
With this approach:
public override string…

vtortola
- 34,709
- 29
- 161
- 263
11
votes
1 answer
mvc-mini-profiler with OutputCacheAttribute
im using mvc-mini-profiler on a test site. When i put an OutputCacheAttribute on my action method, the profiler is not executed and always return the last value that he had before the cache.
is there a way to tell mvc-mini-profiler that the result…

Alexandre Jobin
- 2,811
- 4
- 33
- 43
11
votes
1 answer
OutputCache serving long-stale data
I'm flumoxed... re this and this "meta" questions...
A very basic http request:
GET http://stackoverflow.com/feeds/tag?tagnames=c%23&sort=newest HTTP/1.1
Host: stackoverflow.com
Accept-Encoding: gzip,deflate
which hits a route decorated…

Marc Gravell
- 1,026,079
- 266
- 2,566
- 2,900
11
votes
2 answers
How to Clear OutputCache for Website without Restarting App
Is there a way clear or reset the outputcache for an entire website without a restart?
I'm just starting to use outputcache on a site and when I make a mistake in setting it up I need a page I can browse to that will reset it.

Brian Boatright
- 36,294
- 34
- 81
- 102