我是 ASP.net MVC 的新手
我的路线配置在这里
routes.MapRoute(
name: "ItineraryRoute",
url: "{country}/Itinerary/tours/{TourId}",
defaults: new { controller = "TourDetails", action = "Index" }
);
routes.MapRoute(
name: "TourRoute",
url: "{country}/tours",
defaults: new { controller = "Tour", action = "Index" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
在页面/Russia/tours
中,我有一个链接,这里是代码行:
<a href="@ViewBag.Country/tours/Itinerary/@tour.Id">Day's By Detail's....</a>
当我点击这个时,页面将链接到这个 Url:/Russia/Russia/tours/Itinerary/1
找不到错误 404 http。
您知道为什么我有两个俄罗斯以及如何修复它以将“TourDetailsController”与“TourId”链接起来吗?