MVC 5 ActionLink与区域

时间:2019-07-14 12:31:40

标签: asp.net-mvc-5 actionlink asp.net-mvc-areas

http://localhost:55201/SERVICES/customers/CALLME

如何使用@ Html.ActionLink链接

服务是RouteArea,客户是RoutePrefix,客户是控制器

@ Html.ActionLink(“点击我”,“ CallMe”,新建{area =“ Services”}) 这个代码对吗?其返回的空白锚点。

[RouteArea("Services")]
[RoutePrefix("Customers")]

public class CustomerController : Controller
{
    [Route("~/Test")]
    public ActionResult Index()
    {
        ViewBag.Controller = "Customer";
        ViewBag.Action = "Index";
        return View("ActionName");
    }
    [Route("CallMe")]
    public string CallMeFunction()
    {
        return string.Format("CallMeFunction() invoked");
    }
  }

0 个答案:

没有答案