나는이 일을하는 SWORN을 가질 수 있었지만, 어딘가에 선을 따라 분명히 그것을 깨뜨렸다. 아마 VS2008의 ASP.NET MVC에서 VS2010의 ASP.NET MVC2로 마이 그 레이션하는 동안이었을 것입니다.이 ASP.NET MVC2 RC ActionLink가 작동하도록 도와 주시겠습니까?
내 ActionLink :
Html.ActionLink(segment.TitleWithChapterNumber, "Index", "Read", new { bookCode = Model.Product.Id, segmentCode = segment.Index }, null)
나는 그것이 일치 할 것으로 예상 경로는 : 나는 그것이 클릭 http://localhost/Obr/Read/14/0
같이 할 http://localhost/Obr/Read?bookCode=14&segmentCode=0
그러나 :
routes.MapRoute(
"Read",
"Read/{bookCode}/{segmentCode}/{sectionCode}/{renderStrategy}",
new { controller = "Read", action = "Index", bookCode = "", segmentCode = "", sectionCode = "", renderStrategy = "" }
);
이처럼 보이는 링크를 렌더링 링크를 렌더링하면 올바른 컨트롤러로 이동하게되고 응답이 정확합니다. 링크를 붙여 넣으면 모양이 좋아 보이지만 제대로 작동합니다. 일치하는 것 같아요?
나는 분명한 뭔가를 놓치고 있습니까? 나는 너무 오랫동안 내가 뭘 더 이상 찾고 있는지조차 몰랐다.
참고로, 여기 내 노선 모두 :
액션 서명은 다음과 같습니다routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"ReadImage",
"Read/Image/{bookId}/{imageName}",
new { controller = "Read", action = "Image" }
);
routes.MapRoute(
"Read",
"Read/{bookCode}/{segmentCode}/{sectionCode}/{renderStrategy}",
new { controller = "Read", action = "Index", bookCode = "", segmentCode = "", sectionCode = "", renderStrategy = "" }
);
routes.MapRoute(
"BookReport",
"BookReport/{action}/{folder}",
new { controller = "BookReport", action = "Details", folder = "" }
);
routes.MapRoute(
"Reference",
"Reference/Details/{referenceType}/{searchText}",
new { controller = "Reference", action = "Details", referenceType = "", searchText = "" }
);
routes.MapRoute(
"PaginatedAudits", // Route name
"Audit/Page/{pageNumber}", // URL with parameters
new { controller = "Audit", action = "Index" } // Parameter defaults
);
routes.MapRoute(
"PaginatedReadLog", // Route name
"ReadLog/Page/{pageNumber}", // URL with parameters
new { controller = "ReadLog", action = "Index" } // Parameter defaults
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
:
[Authorize]
public ActionResult Index(string bookCode, string segmentCode, string sectionCode, string renderStrategy)
{
// code
}
다른 경로를 따라 잡아야합니다. ReadController로 향하는 다른 경로가 있습니까? –
좋은 질문입니다. 내 전체 RegisterRoutes 본문을 추가했습니다. – Chris
당신의 행동은 어떻게 생겼습니까? – Odd