How to get HTML before its sent to the browser
I would like 开发者_开发问答to capture HTML before its gets sent to the browser for caching. Is there a way to do this?
I've never tried this, but could you hook into the EndRequest event of an HTTP module, and simply read the Response property?
Edit: Just tried this - massive fail, at least at a simple level, because the Response isn't readable at that point. Could still be viable if there's a way to redirect the output of the Response at the beginning of a request, and then pipe it through at the end.
Edit #2: I was close, but it's more complex than I thought. You need to implement a filter, which is demonstrated nicely here.
精彩评论