in my asp.net mvc project, I enable output caching on the controller as shown below
[OutputCache(Duration = 100, VaryByParam = "*", VaryByHeader = "X-Requested-With")] public class CatalogController : BaseController { public ActionResult Index(string seller) {
it works fine until my own Route class is created as shown below
public class MyRoute : Route { // there is a constructor here.. // I override this method.. // just to add one data called 'seller' to RouteData public override RouteData GetRouteData(HttpContextBase httpContext) { var data = base.GetRouteData(httpContext); if (data == null) return null; var seller = DoSomeMagicHere(); // add seller data.Values.Add("seller", seller); return data; } }
and then the action method will accept seller as a parameter. I tested it, always providing different parameters to seller , but it takes cache output instead of calling a method.
Does the setting VaryByParam = "*" also depend on the RouteData.Values parameter in asp.net mvc?
I am using ASP.Net 4 MVC 3 RC 2
source share