【发布时间】:2014-11-29 01:28:51
【问题描述】:
我设置了以下属性
[Route("{country}/{state}/{city}/listing/{name?}/{address}/{id}", Name = "ViewListing")]
public ActionResult Index()
{
...
}
以下网址可以正常工作
http://localhost:16949/ca/on/london/listing/something/1830-avalon-street/d46fc94f-9a90-460a-b18f-7443db3c1897
但是下面给出了 404,即使 name 参数设置为可选
http://localhost:16949/ca/on/london/listing/1830-avalon-street/d46fc94f-9a90-460a-b18f-7443db3c1897
我还定义了其他路由,它们具有相同数量的不同结构的参数,并且这些路由也不会触发(它们也不应该触发),为清楚起见,这里是其他路由
CITY
{country}/{state}/{city}
{country}/{state}/{city}/{type}
{country}/{state}/{city}/bedrooms/{parameters}
{country}/{state}/{city}/{type}/bedrooms/{parameters}
{country}/{state}/{city}/area/{area}
{country}/{state}/{city}/area/{area}/bedrooms/{parameters}
【问题讨论】:
标签: asp.net-mvc routes custom-attributes