Is it possible to get the currently used ViewEngine
from the ControllerContext
or the ViewEngineCollection
? I would like to be able to do say the following ViewEngines.GetCurrent
. I know that I can make an extension for that method but I have no idea on how to implement this.
You can use ViewEngineCollection
to look up the ViewEngine
associated with a particular view.
ViewEngineResult result = ViewEngines.Engines.FindView(controllerContext,
"myView","myMaster");
IViewEngine viewEngine = result.ViewEngine;
See here for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With