C# 无法为我的MVC区域呈现正确的URL

C# 无法为我的MVC区域呈现正确的URL,c#,asp.net-mvc,asp.net-mvc-areas,C#,Asp.net Mvc,Asp.net Mvc Areas,刚刚开始钻研路线区域。在我开始喜欢之前,我先尝试一些基本的东西。当我在地址栏中输入物理路由时,效果非常好。但是,当我尝试使用@Url.Action或@Html.ActionLink创建链接时,MVC无法计算正确的路由 键入此选项有效: 因此,我知道路线设置正确… http://localhost:51515/intro/tutorials/one 我的控制器看起来像: 同样,当我在地址栏中键入它时,它会正确解析… [RouteArea("intro")] [RoutePrefix("tutor

刚刚开始钻研路线
区域
。在我开始喜欢之前,我先尝试一些基本的东西。当我在地址栏中输入物理路由时,效果非常好。但是,当我尝试使用
@Url.Action
@Html.ActionLink
创建链接时,MVC无法计算正确的路由

键入此选项有效: 因此,我知道路线设置正确…

http://localhost:51515/intro/tutorials/one
我的控制器看起来像:
同样,当我在地址栏中键入它时,它会正确解析…

[RouteArea("intro")]
[RoutePrefix("tutorials")]
[Route("{action}")]
public class IntroTutorialsController : Controller
{
    public ActionResult One()
    {
        var path = @"~/Views/tutorials/intro/one.cshtml";
        return View(path);
    }
}
我对URL的悲伤尝试:
显然,问题就在这里……

@Html.ActionLink("intro", "one", "tutorials", new { Area = "intro" }, null)
<a href="@Url.Action("one", "tutorials", new { Area = "intro" })">One</a>
@Html.ActionLink(“intro”,“one”,“tutorials”,new{Area=“intro”},null)
这些都不能解决任何问题和/或胡说八道

旁注:
如果我
手动键入
url进入链接…它们会起作用

例如:

  • href=“/intro/tutorials/one”

    • 很抱歉不得不回答我自己的问题……

      <> P>显然,<代码> HTML。Action Link 和<代码> URL。Action < /Cord>命令不考虑任何属性前缀。您可能已经安装了控制器。因此,您仍然必须以正常格式输入操作和控制器名称…然后…添加到您的
      区域

      这对我很有效…

      @Url.Action("one", "introtutorials", new { Area = "intro" })