mvc,未找到视图或其母版视图,或没有视图引擎支持搜索的位置

The view '~/Views/Home/Login.cshtml' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/Login.cshtml

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.InvalidOperationException: The view '~/Views/Home/Login.cshtml' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/Login.cshtml

我的controller这样写的:
public ActionResult Login()
{
return View("~/Views/Home/Login.cshtml");
}

return View(); 即可。

<add key="webpages:Enabled" value="false" />

应该用response.redict("~/Views/Home/Login.cshtml")来跳转,但是新建的MVC项目里给的配置文件Web.config默认的 是
,这里把webpages禁用了,所以cshtml的后缀不能再用物理路径的方式,只能通过控制器了。
只是针对cshtml,不包括其他后缀比如aspx、html,要了解net的三大变成方式webpages、Webforms、MVC,都是要混用的。

  Response.Redirect("~/视图/网页");

你要是想引用模板页不是这样来引用的