0
public class PostController : YourDefinitionController
{
public ActionResult Test(int id ,int title)
{
return View();
}
}
@Html.ActionLink("Postss", "Test","Post" ,new { title = "asdf",id=3 },null)//in Razor view
// here is route registration
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Post",
"{Post}/{Test}/{title}/{id}",
new { controller = "Post", action = "Test",id=UrlParameter.Optional, title=UrlParameter.Optional }
);
routes.MapRoute(
"Defaultx", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
/Post/Test/asdf/3과 같은 링크가 예상되지만/Post/Test/3입니까? title = 3 이유가 무엇입니까? 어떻게 해결할 수 있습니까?다른 경로로 작업 링크를 만드시겠습니까?
여전히 동일한 결과 : ( – Freshblood
아 .. 경로 경로가 잘못되었습니다. "게시물/테스트/{제목}/{ID}"로 변경하십시오. – Damb
많은 도움을주었습니다. – Freshblood