Are any events raised when a controller requests a view or partial view? Similar to FindView/FindPartialView on the IViewEngine interface. I need to know what views are requested, but dont want to have to write my own view engine.
Any suggestions?
Are any events raised when a controller requests a view or partial view? Similar to FindView/FindPartialView on the IViewEngine interface. I need to know what views are requested, but dont want to have to write my own view engine.
Any suggestions?
You don't have to write your own view engine; inherit from WebFormViewEngine and 99% of the work is done:
public class InterceptorViewEngine : WebFormViewEngine
{
public override ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache)
{
Logger.Log(viewName + " view requested");
return base.FindView(controllerContext, viewName, masterName, useCache);
}
}