Questions tagged [outputcache]

OutPut Cache is the caching technique to cache the static pages in ASP.NET.

680 questions
112
votes
2 answers

How do I use VaryByParam with multiple parameters?

In ASP.NET MVC2 I use OutputCache and the VaryByParam attribute. I got it working fine with a single parameter, but what is the correct syntax when I have several parameters on the method? [OutputCache(Duration=30, VaryByParam = "customerId"] public…
Frode Lillerud
  • 7,324
  • 17
  • 58
  • 69
52
votes
8 answers

Clearing Page Cache in ASP.NET

For my blog I am wanting to use the Output Cache to save a cached version of a perticular post for around 10 minutes, and thats fine... <%@OutputCache Duration="600" VaryByParam="*" %> However, if someone posts a comment, I want to clear the cache…
GateKiller
  • 74,180
  • 73
  • 171
  • 204
51
votes
5 answers

Output caching for an ApiController (MVC4 Web API)

I'm trying to cache the output of an ApiController method in Web API. Here's the controller code: public class TestController : ApiController { [OutputCache(Duration = 10, VaryByParam = "none", Location = OutputCacheLocation.Any)] public…
Samu Lang
  • 2,261
  • 2
  • 16
  • 32
22
votes
3 answers

Why can't I combine [Authorize] and [OutputCache] attributes when using Azure cache (.NET MVC3 app)?

Using Windows Azure's Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider as the outputCache provider for an MVC3 app. Here is the relevant action method: [ActionName("sample-cached-page")] [OutputCache(Duration = 300, VaryByCustom =…
danludwig
  • 46,965
  • 25
  • 159
  • 237
21
votes
6 answers

Disable caching on a partial view in MVC 3

I have an issue with a partial View being cached when it shouldn't be. This partial View is used to display the Logon/Logoff on a page. It uses the simple code below to figure out which link to display @if(Request.IsAuthenticated) {
SimpleUser
  • 1,341
  • 2
  • 16
  • 36
20
votes
3 answers

ASP.NET MVC OutputCache vary by * and vary by user cookie

I have an asp.net mvc 3 project and I have a home controller. I have tagged my Index action with this attribute: [OutputCache(Location = System.Web.UI.OutputCacheLocation.Any, Duration = 120, VaryByParam = "*", VaryByCustom = "user")] public…
jjxtra
  • 20,415
  • 16
  • 100
  • 140
20
votes
5 answers

programmatically control output caching - disable or enable cache according to parameter value

We've got a fairly standard e-commerce scenario with paged lists of products within categories. For better or worse, about 80% of visitors never navigate past the first page, depending on the category there may then be 5-10 more pages of results…
Andrew M
  • 9,149
  • 6
  • 44
  • 63
19
votes
1 answer

OutputCache Location=Client does not appear to work

I am trying to use the OutputCache attribute in my MVC app and it doesn't appear to work when I use OutputCacheLocation.Client: public class HomeController : Controller { [OutputCache(Duration=15, Location=OutputCacheLocation.Client)] public…
Dismissile
  • 32,564
  • 38
  • 174
  • 263
19
votes
7 answers

Disable client side caching

I've been searching for info on how to disable client side caching on project level. I know I can add the following before an action method: [System.Web.Mvc.OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")] I also read something about…
burktelefon
  • 988
  • 2
  • 8
  • 27
19
votes
3 answers

How does memcache store data?

I am a newbie to caching and have no idea how data is stored in caching. I have tried to read a few examples online, but everybody is providing code snippets of storing and getting data, rather than explaining how data is cached using memcache. I…
macha
  • 7,337
  • 19
  • 62
  • 84
18
votes
1 answer

Setting optimum http caching headers and server params in ASP.Net MVC and IIS 7.5

I have an ASP.Net site (happens to be MVC, but that's not relevant here) with a few pages I'd like cached really well. Specifically I'd like to achieve: output cached on the server for 2 hours. if the file content on the server changes, that…
Nik
  • 2,718
  • 23
  • 34
17
votes
2 answers

Disable OutputCache on Development System

I use OutputCache in an ASP.net MVC application. As developing with an active OutputCache is not very pleasant I want to disable the OutputCache on the Development Systems (local machines and development server). What is the best way to do this?
chbu
  • 985
  • 1
  • 8
  • 18
17
votes
1 answer

Why is output caching not working for my ASP.NET MVC 4 app?

I am having an issue where output caching doesn't appear to be working for my ASP.NET MVC 4 (EPiServer 7) website. I have the following output cache profile in my web.config:
16
votes
2 answers

Understand If-Modified-Since HTTP Header

I am looking at a Caching library that is trying to use the If-Modified-Since header of a request object. The problem is this header never gets set, it is always blank which makes sense to me seeing how it is a REQUEST. How can you force a request…
Mike
  • 12,359
  • 17
  • 65
  • 86
16
votes
4 answers

Expire Output Cache ASP.Net MVC

I am using the standard outputcache tag in my MVC app which works great but I need to force it to be dumped at certain times. How do I achieve this? The page that gets cached is built from a very simple route {Controller}/{PageName} - so most…
Slee
  • 27,498
  • 52
  • 145
  • 243
1
2 3
45 46