houxiaobei

如上图(我从网上的截图)所示,很多情况下可能不需要一个渲染的页面,所以需要返回一个  .html  的页面,但是ASP.NET只识别渲染的页面,而不识别  .html 的页面。

所以想返回的话用如下方法:

ASP.NET MVC

public ActionResult Index()
{
    return new FilePathResult("~/content/index.html", "text/html");
}

ASP.NET Core MVC

public IActionResult Index()
{
    return File("~/index.html", "text/html");
}

 

分类:

技术点:

相关文章:

  • 2021-12-05
  • 2021-11-09
  • 2021-04-12
  • 2021-11-05
  • 2021-12-05
  • 2021-12-15
  • 2021-12-15
  • 2021-12-15
猜你喜欢
  • 2021-12-15
  • 2021-11-05
  • 2021-12-05
  • 2021-11-10
  • 2022-01-16
  • 2021-12-05
  • 2021-11-14
相关资源
相似解决方案