MVC를 배우기 때문에 왜 작동하지 않는지 이해해야합니다.MVC 라우팅 문제
public static void RegisterRoutes(RouteCollection routes)
{
// Note: Change the URL to "{controller}.mvc/{action}/{id}" to enable
// automatic support on IIS6 and IIS7 classic mode
//http://localhost/store/category/subcategory/product
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Category", // Route name
"store/{category}/{subcategory}", // URL with parameters
new
{
controller = "Catalog",
action = "Index",
category = "Featured Items",
subcategory = "All Items"
}
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" }, // Parameter defaults
new { controller = @"[^\.]*" } // Parameter constraints
);
}
내가 웹 응용 프로그램을 시작할 때 나는 다음 URL을 참조해야 라우팅을 이해하는 방법 :
HTTP : 여기
내 라우팅입니다/로컬 호스트/상점/무엇 나는 두 번째 경로를 얻는다 ....
두 번째 경로를 "home/{action}/{id}"로 변경하면 어떤 경로도 잡지 않는다.
이 점을 이해할 수 있도록 도와주세요. 감사합니다.