如果有子文件夹,如何从一页移动到另一页?
控制器:
观看次数:
动作:
AccountController
...
[HttpGet]
[AllowAnonymous]
public async Task<IActionResult> Login...
{
return View("~/Views/Account/Login.chtml");
}
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Login...
{
...
return View("~/Views/Account/Login.chtml", login);
}
...
public IActionResult TypeRegister()
{
return View("~/Views/Account/TypeRegister.chtml");
}
}
}
发件人: 索引页[HomeController]
<li><a asp-controller="Account" asp-action="Login">Log In</a></li>
收件人: 登录页面[Accounts / AccountController]
答案 0 :(得分:2)
您做对了,但是有错字。文件扩展名是.cshtml而不是.chtml
Views/[ControllerName]/[ViewName].cshtml
Views/Shared/[ViewName].cshtml
https://docs.microsoft.com/en-us/aspnet/core/mvc/views/overview?view=aspnetcore-2.2