2

I'm writing an application in MVC3. it has features like login, a simple forum, news, and pages that get their main content from the db. I'm looking into caching right now.

First I tried the simple [OutputCache] attribute but noticed that it caches the same content for every user. Normally it wouldn't be that much of a problem, but - for example - the login box is cached too and therefore it shows the same content for every user (and everybody will just see that they are logged in as admin). Even if I set Location=OutputCacheLocation.Client, after a logout the cached page still shows that I'm logged in.

No matter, I thought I can always try Response.WriteSubstitution, but for some reason it seems to be broken in MVC3.

I'm now reading about the "ASP.NET MVC Result Cache", and it seems interesting, but is it a proper way to handle caching?

Also am I able to cache childactions, or partial views in an otherwise very dynamic page?

There are so many options and I don't know what should I use and when.

Sorry that my question is so vague, but I don't even know what to ask in this case.

vinczemarton
  • 7,756
  • 6
  • 54
  • 86

1 Answers1

0

I think this post my solve your problem.

MVC3 custom outputcache

Good luck

Community
  • 1
  • 1
mp3duck
  • 2,633
  • 7
  • 26
  • 40