Im working with MVC 3 and Currently this is my code that needs to not be Cached and it shared among several views
<div id="logindisplay">
<h2> Welcome <strong><%= Context.User.Identity.Name %></strong></h2>
</div>
all my pages have this at the top that includes the master view that has this in it
%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
And finally, all my controllers have this in it on the Index() action
[OutputCache(Duration=60*60*24)]
public ActionResult Index()
{
return View();
}
some of my partial views have it too
my question is what is the best way of implementing a partial caching/donut caching kind of thing here? I'd like to use other open source libraries as a last resort because if there is a more simple solution out of the MVC 3 box, I don't know it and would appreciate your help!!!
UPDATE since i am unable to answer my own questions right now
So I used this attribute on OutputCache instead. Apparently it should work, since my problems were stemming from it being cached on the server side, and that line of code that I do not want cached is evaluated on the server side!
[OutputCache(Location = OutputCacheLocation.Client,Duration = 60 * 60 * 24)]