Intercept output stream for pre-send manipulation

Aug 22, 2014 at 8:36 AM
Hi all
I need to write a middleware that intercept the output stream from the StaticFileMiddleware to manipulate it before sending it to the browser.
What I need is the HTML of the file that is being served because I need to inject some text at runtime.
Is it possibile? Any hint on how to start?

Aug 22, 2014 at 1:09 PM
The static file middleware should not be used as a templating engine. Modifing the output would break all the cache control logic, not to mention ruin the performance. See the discussion at
Marked as answer by ema on 8/25/2014 at 11:25 AM
Aug 25, 2014 at 6:25 PM
Thanks. I'm aware of performance problems, but I'm building a "Single-user-app" that use a single web page to customise some settings. Anyway the thread that you gave to me is enough to get started the right way.