Razor engine cant find view

前端 未结 2 1986
暖寄归人
暖寄归人 2021-01-12 04:28

Im trying to render a html from a view without using a web request. I need the HTML as a string, internally, i do not wish to serve it.

The viewEngine.FindView() re

2条回答
  •  有刺的猬
    2021-01-12 05:02

    I had the same issue. I found the answer here: GitHub aspnet/Mvc Issue #4936

    Basically, use GetView instead of FindView, like this:

    var viewResult = razorViewEngine.GetView(viewName, viewName, false);
    

提交回复
热议问题