나는 지역이 MyArea라고하고이과 같이 등록되어 :ASP.Net MVC 경로 문제
context.MapRoute(null, "MyArea", new { controller = "MyAreaController", action = "Index" });
//Properties
context.MapRoute(null, "MyArea/properties", new { controller = "Property", action = "Index" });
context.MapRoute(null, "MyArea/properties/edit/{propertyId}", new { controller = "Property", action = "Property" });
//Units
context.MapRoute(null, "MyArea/properties/edit/{propertyId}/units/{unitId}", new { action = "Unit", propertyId = 1, unitId = 1 });
그것은 하나 개의 속성이 많은 유닛을 가지고 일을해야한다, 그래서 나는이 같은 것을보고 내 URL을 싶습니다
http://localhost:50182/myarea/properties/edit/4/units/1
내가 Html.ActionLink에 사용하는 코드는 외모와 같은 :
@Html.ActionLink("Add new Unit", "Unit", "Unit", new { propertyId = 1, unitId = 1 })
유닛이라는 액션이있는 유닛 컨트롤러가 있습니다. 내가 도와 줄 수있는 것이 무엇입니까?
감사합니다.
어떤 문제가 있습니까? –
링크가 http : // localhost : 50182/myarea/properties/edit/4/units? controller = 속성 및 길이 = 4 이 아닌 http : // localhost : 50182/myarea/properties/edit/4로 이동합니다./units/1 다음과 같은 오류 메시지가 표시됩니다. 값을 null 또는 비워 둘 수 없습니다. 매개 변수 이름 : controllerName – Pete