How could I insert a string into the response stream anywhere I want?

Posted by DM on Stack Overflow See other posts from Stack Overflow or by DM
Published on 2010-05-07T19:19:10Z Indexed on 2010/05/07 20:08 UTC
Read the original article Hit count: 144

There may be an easy way to do this but I can't see it...

I created a simple Http Module that starts a timer on the PreRequestHandler and stops the timer on the PostRequestHandler to calculate the time it took the page to load.

I then create some simple html and write my results to Response.Write. Since I'm doing this in the PostRequestHandler it's adding my results after the </html> tag. That's fine for testing but I need in a scenario where the page needs to validate.

I can't seem to figure out how I could manipulate the Response object to insert my results before the </body> tag. Response.Write and Response.Output.Write don't have that flexibility and I couldn't see a way to work with the Response as a string. Am I missing something easy?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about response.write