我有一个航班预订网站,我设置路线
character = chr(ord(fileText[0][i]) + shiftValue)
和
routes.MapRoute(
"RouteFlights",
"{action}/{path}/{date}/{clock}/{count}",
new { controller = "Flight",
action = "flights",
path = UrlParameter.Optional,
date = UrlParameter.Optional,
clock = UrlParameter.Optional,
count = UrlParameter.Optional }
,new[] { "parvaz24pro.Controllers" }
);
它仅适用于网址
“www.site.com/flights/source-dest/2016-2-16/1/1”
但不适用于“www.site.com/flights/source-dest/2016-2-16”
完整路由配置链接
http://preschool-doosti.com/RouteConfig.zip
我找不到解决方案
答案 0 :(得分:0)
您需要针对这两种情况中的每一种进行路线映射。只需添加第二条路线:
routes.MapRoute(
"RouteFlights2",
"{action}/{path}/{date}",
new { controller = "Flight",
action = "flights",
path = UrlParameter.Optional,
date = UrlParameter.Optional }
,new[] { "parvaz24pro.Controllers" }
);