开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜