ASP.NET MVC 라우팅을 시도하고 있는데 문제가 발생했습니다. 나는/Admin/Pages/섹션을 가지고 있으며/Pages /를 통해서도 접근 할 수있다. 나는 무엇을 놓칠 수 있 었는가? Global.asax에있는Asp.net MVC 라우팅이 모호합니다. 동일한 페이지에 대해 두 경로가 있습니다.
라우팅 코드 :
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Pages", // Route name
"Admin/Pages/{action}/{id}", // URL with parameters
// Parameter defaults
new { controller = "Pages", action = "Index", id = "" }
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
// Parameter defaults
new { controller = "Home", action = "Index", id = "" }
);
}
감사합니다!
이것이 의도적 인 이유는 PagesController의 Index 작업 메서드를 보호하기위한 것이기 때문입니다. –