Is it possible to attach the PageBuilder to a dynamic controller?

James Mosquito asked on October 6, 2020 13:17

Hi, I have been able to render PageBuilder content into an IHtmlString property by initializing the PageBuilder on a generic controller using the current HttpContext. It seems to work fine as long as the request is made from within a routed controller action. However, if I try to do this by calling an action from within a Layout it fails warning me that the UsePageBuilder() method needs to be called on startup for the PageBuilder to be accessible. I suspect that in these cases the HttpContext is missing something.

Is there some global HttpContext I can reference from the dependency resolver? Or some other way to intialize the PageBuilder on a temporary controller that is dynamically created at runtime?

   Please, sign in to be able to submit a new answer.