ASP.NET MVC隐式添加路由值 [英] ASP.NET MVC implicitly adds route values

查看:101
本文介绍了ASP.NET MVC隐式添加路由值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建的ActionLink调用Html.ActionLink并传递路线反对。不过貌似ASP.NET MVC隐式地从当前通话增加等航线。

I create ActionLink calling Html.ActionLink and passing route object to it. But looks like ASP.NET MVC implicitly adds other routes from current call.

例如,如果我有两条路线:SomePage的/页/ {PAGE}和SomePage的,目前用户所请求的页面与第一根,网页路线值将被默认添加到ActionLink的可以和我'T创建ActionLink的第二个根源。

For example, if I have two routes: "somepage/page/{page}" and "somepage" and currently user requested the page with the first root, "page" route value will be implicitly added to ActionLink and I can't create ActionLink to the second root.

推荐答案

你是如何为了您的路由定义?的顺序是非常重要的!最具体的路线应该是第一条路线,你必须定义和最常见的是最后一个。

How did you order your route definitions? The order is very important! The most specific route should be the first route you have to define and the most common the last one.

这篇关于ASP.NET MVC隐式添加路由值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆