Rendering .html files as views in ASP.NET MVC

前端 未结 2 737
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 11:47

I would like to have .html files serve as views alongside other .cshtml views in my ASP.NET MVC project. The main reason for this is so that the html files are subject to th

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-30 12:31

    I found a solution. In my action I return FilePathResult and it just loads the file and passes it through without any compilation.

    return new FilePathResult("path_and_file.html", "text/html");
    

提交回复
热议问题