
如上圖(我從網上的截圖)所示,很多情況下可能不需要一個渲染的頁面,所以需要返回一個 .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"); }
