How can I get RouteData values on a cached request in ASP.NET MVC?
I´m trying to get the following code to work:
RouteData data = context.Request.RequestContext.RouteData;
if (data == null)
dat开发者_开发知识库a = RouteTable.Routes.GetRouteData(new HttpContextWrapper(context.Context));
var name = data.DataTokens["Name"].ToString();
But seems that when I got a cached request ([OutputCache]d) the RouteData is unavailable, and I can´t even manage to get it using GetRouteData() on the route table.
Does anyone have some luck with that?
精彩评论