开发者

How to get HTML before its sent to the browser

开发者 https://www.devze.com 2023-04-08 09:11 出处:网络
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 m

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消