을 :URL에서 액션 이름을 제거하고 URL에 페이지 제목을 추가 -이 같은 URL이 Asp.net MVC
http://localhost:17594/Contact/Contact
지금 내가 이런 식으로 보여주고 싶은 :
http://localhost:17594/Contact/Contact-us
RouteConfig을 :
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Categories",
url: "Categories/{id}",
defaults: new { controller = "Categories", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "FinalKaminet.Controllers" }
);
routes.MapRoute(
name: "Contacts",
url: "{controller}/{title}",
defaults: new { controller = "Contact", action = "Contact", title = UrlParameter.Optional },
namespaces: new[] { "FinalKaminet.Controllers" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}/{title}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional , title = UrlParameter.Optional },
namespaces: new[] { "FinalKaminet.Controllers" }
);
}
보기
하지만 633 번 노선에서 Categories
경로를 사용하는 중에 오류가 발생했습니다.
Exception Details: System.InvalidOperationException: No route in the route table matches the supplied values.
Source Error:
Line 62: @Html.ActionLink("وبلاگ", "")
Line 63: @Html.Action("MenuCat" , "Home")
무엇이 잘못 되었나요?