I have a ASP.NET MVC 4 controller that looks like this:
#if !DEBUG
[OutputCache]
#endif
public class LearningController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Articles(string name)
{
... return dynamic content here based on name
}
}
Then I have a RouteConfig which maps "name" to the URL, like this:
routes.MapRoute(
name: "Articles",
url: "learning/articles/{name}",
defaults: new { controller = "Learning", action = "Articles" }
);
The caching appears to work. When I set a @DateTime.Now
in the .cshtml file and use release, it is indeed caching. Additionally, each article (by name) is returning the dynamic content correctly as well. What's more, is if I revert to query string (remove the MapRoute altogether), it still all works correctly.
Can anyone explain to me why this is working properly without a VaryByParam
? I ask because I'm concerned that the dynamic action is not caching properly, or when I go into production might start serving incorrect content.