I\'m attempting to use the new partial page caching available in ASP.NET MVC 3. In my view, I\'m using:
<% Html.RenderAction(\"RenderContent\", Model); %
I think I figured it out. It looks like the issue is that VaryByParam, when the input parameter is an object, uses ToString()
on that object to determine it's uniqueness. So this leaves two options:
ToString()
to provide a unique identifier.Passing a unique identifier as an additional parameter:
<% Html.RenderAction("RenderContent", Model, Model.Id); %>
[Authorize]
[OutputCache(Duration = 6000, VaryByParam = "id", VaryByCustom = "browser")]
public ActionResult RenderContent(Content content, string id)
{
return PartialView(content);
}