Reputation: 46699
I want to do some additional processing of the output of all my views before they get sent to the client.
I tried setting the view base class to a custom class where I override Execute
, but that doesn't work because Razor will generate its own Execute
in the derived class that doesn't call mine.
Is there another MVC-specific way to do it, or my only hope is to resort to the "classic" way of doing it, by setting Response.Filter
in Application_BeginRequest
in Global.asax?
Upvotes: 1
Views: 481
Reputation: 39491
You should implement IResultFilter. Common way to do it is by deriving from ActionFilterAttribute
void OnResultExecuted(
ResultExecutedContext filterContext
)
Upvotes: 2