我有一个像这样的文件结构:
/Areas/ProjectApp/Controllers/
/Areas/ProjectApp/Models/
/Areas/ProjectApp/Views/
Inside Views文件夹我有一个projectlist.cshtml,其链接如下:
<a href="@Url.Action("Index")">Project Home</a>
项目住宅实际在:
http://localhost:57538/ProjectApp
路线虽然如此生成:
http://localhost:57538/?action=Index&controller=Home
反过来导致它:
http://localhost:57538/ (the home page of the bigger app)
我该如何解决这个问题?提前谢谢。
答案 0 :(得分:1)
看起来您正在使用区域,在这种情况下,您必须在Url.Action
中指定区域。
<a href="@Url.Action("Index", "Home", new { Area = "ProjectApp" })">Project Home</a>