2014-02-25 3 views
0

면도날 구문과 관련하여 잘못된 점을 파악해주세요. MVC 작업에 대한 링크가있는 앵커 태그를 출력하려고합니다.ActionLink에서 올바른 경로를 출력하지 못했습니다.

면도기 구문 : 브라우저에서

@Html.ActionLink("Back to Reports List", "Index", "Reports") 

출력 :

<a href="/">Back to Reports List</a> 

하지 :

<a href="/Reports/Index">Back to Reports List</a> 

어떤 생각?

+0

본 적이 있습니까? : http://stackoverflow.com/questions/7439375/having-a-problem-outputting-the-correct-url-from-an-actionlink –

답변

2

경로 구성을 표시하십시오. 해당 URL을 기반으로 생성됩니다. 경로 구성이 다음으로 시작될 수 있습니다.

routes.MapRoute(
     name: "Default", 
     url: "{controller}/{action}/{id}", 
     defaults: new { controller = "Reports", action = "Index", id = UrlParameter.Optional } 
); 
+0

Thanks Peter. Spot on - 문제였습니다. 나는 ActionLink가 경로 설정을 검사하여 경로를 출력 하는지를 몰랐다! 많은 감사 –

관련 문제