조직이라는 영역이 있습니다. 이 영역에는 Url.Action 링크가있는보기가 있습니다.영역이있는 ASP.NET MVC 라우팅
기본적으로 작업 이름을 전달하면 조직 영역의 현재 컨트롤러에서 작업을 호출합니다.
컨트롤러 폴더 (영역이 아님)에 컨트롤러가 있고 그 컨트롤러에서 작업을 호출하고 싶습니다.
기본적으로이 동작은 모든 영역에서 호출 할 수 있습니다. 이것을 달성하는 가장 좋은 방법은 무엇입니까?
이것이 완전히 잘못된 길인 경우에는 제안을 할 수 있습니다.
감사합니다,
편집 - 여기 당신은 그에 대한 특정 경로를 만들 필요가
Global.asax에
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Columns",
"Columns/Columns/{ID}/{idList}",
new { controller = "Columns", action = "UserColumnList" }
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Account", action = "Login", id = UrlParameter.Optional } // Parameter defaults
);
}
OrganisationsAreaRegistration.cs
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Organisations_view",
"Organisations/{id}/View",
new { controller = "Manage", action = "View" }
);
context.MapRoute(
"Organisations_general",
"Organisations/{id}/General",
new { controller = "Manage", action = "General" }
);
context.MapRoute(
"Organisations_addressbook",
"Organisations/{id}/AddressBook",
new { controller = "Manage", action = "AddressBook" }
);
context.MapRoute(
"Organisations_departments",
"Organisations/{id}/Departments",
new { controller = "Manage", action = "Departments" }
);
context.MapRoute(
"Organisations_people",
"Organisations/{id}/People",
new { controller = "Manage", action = "People" }
);
context.MapRoute(
"Organisations_events",
"Organisations/{id}/Events",
new { controller = "Manage", action = "Events" }
);
context.MapRoute(
"Organisations_journal",
"Organisations/{id}/Journal",
new { controller = "Manage", action = "Journal" }
);
context.MapRoute(
"Organisations_tasks",
"Organisations/{id}/Tasks",
new { controller = "Manage", action = "Tasks" }
);
context.MapRoute(
"Organisations_edit",
"Organisations/{id}/Edit",
new { controller = "Manage", action = "Edit" }
);
context.MapRoute(
"Organisations_journalnew",
"Organisations/{id}/{action}",
new { controller = "Manage" }
);
context.MapRoute(
"Organisations_recent",
"Organisations/{action}",
new { controller = "Manage", action = "Index" }
);
context.MapRoute(
"Organisations_default",
"Organisations/{controller}/{action}/{id}",
new { controller = "Manage", action = "Index", id = UrlParameter.Optional }
);
}
대우를 받으면, 때로는 단순합니다! 감사. – Paul