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");
}

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-10-22
  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2021-12-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
相关资源
相似解决方案