【发布时间】:2013-08-04 18:36:26
【问题描述】:
我想在 MVC .net 中使用纯 html 页面而不是 cshtml。 但是当我通过右键单击索引添加视图时,我只能看到两个选项。
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
return View();
}}
- Cshtml(剃刀)
- aspx
论坛,但仍然没有帮助。我仍然没有看到添加 html 而不是 cshtml 的选项
我也尝试将 html 页面直接添加到视图文件夹,但我不知道如何从我的控制器功能指向该视图。
用 Index.html 替换 Index.cshtml 给了我这个错误
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Home/Index.cshtml
~/Views/Home/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
【问题讨论】:
-
您是否要在主布局中提供一个全新的 html 页面?
-
stackoverflow.com/questions/1292475/… POST 中的这个答案也很好用......
-
有人可以修复这篇文章中的代码缩进/格式吗?
标签: asp.net asp.net-mvc razor