如何用新的路由数据值重写asp.net mvc中的当前路由



在我的site.master中,我需要能够重写当前路由以匹配移动站点。

基本上我需要能够做到这一点:

<%= Url.RouteUrl("home", new { controller = "Home", action = "Index", environment = "d1" })%>

但我需要知道每个页面请求上的路由名称和值

Joustling

如果有人仍然想知道如何做到这一点,显然你无法获得路线名称

来自Phil Haack:

http://haacked.com/archive/2010/11/28/getting-the-route-name-for-a-route.aspx

但是您可以使用路由名称注册一个数据令牌,然后稍后提取。

最新更新