html 转换为cshtml,使用Html而不是csHtml

博主试图在ASP.NET MVC项目中创建一个纯HTML页面而非使用cshtml。他们在控制器中定义了Index方法返回View,但添加视图时只看到CSHTML和ASPX选项。当尝试直接添加HTML页面并更改默认的Index.cshtml为Index.html时,遇到了找不到视图的错误。问题在于ASP.NET默认配置只查找.cshtml和.aspx视图。
摘要由CSDN通过智能技术生成

我想使用纯HTML页面而不是使用MVC .net的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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值