Razor view engine extension for html post-processing


I would like to perform some post processing on the html that the view engine renders in response to an action request.

Scenario: request for /foo/12 comes in and the FooController returns a view generated from {Action}.cshtml. I would like to get this Html and munge it in some way (not important).

Is this possible? Do I need to write my own view engine for this? Can I extend the razor view engine to make my dream possible?



I believe you can do this by using a Response Filter and an ActionFilter. See http://www.tombatron.com/Articles/Custom-Response-Filters-for-ASPNET-MVC