>백엔드 개발 >C++ >ASP.NET MVC에서 해당 폴더 외부의 컨트롤러에 대한 작업 링크를 만드는 방법은 무엇입니까?

ASP.NET MVC에서 해당 폴더 외부의 컨트롤러에 대한 작업 링크를 만드는 방법은 무엇입니까?

Linda Hamilton
Linda Hamilton원래의
2025-01-22 13:02:10812검색

How to Create Action Links to Controllers Outside Their Folders in ASP.NET MVC?

MVC에서 액션 링크 생성

폴더 외부 위치에서 컨트롤러로 작업하는 경우 원하는 메소드에 대한 링크를 생성해야 합니다. Html.ActionLink 메서드의 경우 다음 매개 변수가 필요합니다.

서명

ASP.NET MVC1:

public static string ActionLink(this HtmlHelper htmlHelper, 
string linkText,
string controllerName,
string actionName,
object values, 
object htmlAttributes)

ASP .그물 MVC2:

public static string ActionLink(this HtmlHelper htmlHelper, 
string linkText,
string actionName,
string controllerName,
object values, 
object htmlAttributes)

ASP.NET MVC3 :

public static string ActionLink(this HtmlHelper htmlHelper, 
string linkText,
string actionName,
string controllerName,
object values, 
object htmlAttributes)

다음 시나리오를 고려하세요.

public class ItemController:Controller
{
    public ActionResult Login(int id)
    {
        return View("Hi", id);
    }
}

외부 페이지에서 로그인 방법에 대한 링크를 생성하려면 Item 폴더에 다음 코드를 사용하세요:

위 내용은 ASP.NET MVC에서 해당 폴더 외부의 컨트롤러에 대한 작업 링크를 만드는 방법은 무엇입니까?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.