I am working on a tool which audits access to existing web application. Existing app does not have any hooks in place, but my plan is to inject an IHttpModule
by modifying web.config and log whatever I need to log during EndRequest
event.
What I'm struggling with right now is: I cannot intercept what is application writing to an output stream. I need to know what output does the application send to the client. Originally, I hoped I could run a code in BeginRequest
to replace HttpContext.Response.OutputStream
with a stream of my own, which would be flushed to original stream during EndRequest
, but the stream only has a get
accessor, so I cannot replace it.
I could of course use reflection to assign to private member of HttpContext
.
Can anyone here think of a better way to tee up contents of what is being written to a given stream?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…