@Url.Content("~/Home/Index")
@Url.Action("Index", "News")
Url.Content vs Url.Action |
Url.Content - 사이트의 파일이나 리소스에 대한 URL을 확인하고 상대 경로를 전달(이미지 등) Url.Action - 컨트롤러에서 작업을 해결하는 데 사용(페이지 이동 및 데이터 전달) |
[ASP.NET MVC] - Url.Content vs Url.Action
○ Url.Content vs Url.Action Url.Content - 사이트의 파일이나 리소스에 대한 URL을 확인하고 상대 경로를 전달(이미지 등) @Url.Content("~/path/file.htm") @Html.Raw(Resources.LangRes.lblTitle) U..
riucc.tistory.com
Url.Content사이트의 파일이나 리소스에 대한 URL을 확인하고 상대 경로를 전달할 때 사용됩니다.
@Url.Content("~/path/file.htm")
Url.Action다음과 같은 컨트롤러의 작업을 해결하는 데 사용됩니다.
@Url.Action("ActionName", "ControllerName", new { variable = value })
자세한 내용은 여기를 참조하세요.
액션 이동 : @Html.ActionLink() |
- 액션 이동 : @Html.ActionLink() 액션 이동을 할 수 있는 링크에 값을 넣어 보낼 수도 있고, 클래스와 스타일 등 다양한 기능도 줄 수 있다 @Html.ActionLink("상세보기", "Details", null, new { id = item.boardNo }, new { @class = "btn btn-info", @style = "margin-right:10px;" }) // ActionLink("보여질 문자열", "액션명", "컨트롤러명", 넣어줄 값, html속성) public static string ActionLink(string linkText, string actionName, string controllerName, object values, object htmlAttributes) |
https://riucc.tistory.com/620?category=784430
'coding > asp.net' 카테고리의 다른 글
@Html.AntiForgeryToken(); (0) | 2022.04.22 |
---|---|
@using (Html.BeginForm()) (0) | 2022.04.22 |
[ASP.NET MVC] Cookie - 쿠키 생성, 적용, 사용, 삭제 + 세션 링크글 (0) | 2022.04.22 |
web.config (0) | 2022.04.22 |
System.DBNull' 형식의 개체를 'System.Nullable`1[System.DateTime]' 형식으로 변환할 수 없습니다. (0) | 2022.04.21 |