【发布时间】:2017-09-20 14:18:39
【问题描述】:
我已经在路由配置文件中启用了属性路由,并且我已经将属性路由声明为
[RoutePrefix("receive-offer")]
public class ReceiveOfferController : Controller
{
// GET: ReceiveOffer
[Route("{destination}-{destinationId}")]
public ActionResult Index(int destinationId)
{
return View();
}
}
public class DestinationController : Controller
{
[Route("{country}/{product}-{productId}")]
public ActionResult Destination(string country, string product, int productId)
{
return View();
}
}
在上述两个控制器中,一个具有静态前缀,另一个具有可变前缀 但我发现多个控制器类型与这两个控制器的 URL 错误匹配。
这个路由模式有什么问题。
【问题讨论】:
-
可以显示网址吗?
-
url 将类似于 (domain/receive-offer/new york-1)////////// (domain/usa/new york-1) 在上述两个 url usa可以替换为接收报价为静态的任何其他国家/地区。
标签: asp.net-mvc asp.net-mvc-4 routing asp.net-mvc-routing