找不到“Test.cshtml”视图。
错误:找不到视图“Test”或其主视图,或者没有视图引擎支持搜索的位置。
搜索了以下位置:
列出的地点包括:
-
~/Views/SecondGroup/Test.aspx
-
~/Views/SecondGroup/Test.ascx
-
~/Views/SecondGroup/123.cshtml
但位置不正确
"~/Views/SecondGroup/Test/123"
??
ViewOne。cshtml(由FirstController生成)
<button onclick= "@("window.location.href ='" + @Url.Action("Test",
"SecondController", new { id = "123" }) + "'");">
GO TO ANOTHER VIEW
</button>
第二控制器
public ActionResult Test(string id)
{
return View("Test", id); // here id = '123'
}
测验cshtml
@model String
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div> .... </div>
以下是文件夹结构:
---Controllers
--- HomeController
--- FirstController
--- SecondController
-- Views
--- FirstGroup
--- ViewOne
--- SecondGroup
--- Test
为什么?
"Test.cshtml"
是否从未找到视图?
非常感谢。