views:

9

answers:

2

I want to find out exactly how long the Response sent to the user was, after the fact, for logging purposes. Is there any way to do this from an HttpModule in asp.net (in the PostRequestHandlerExecute event).

A: 

Unfortunately, HttpResponse.OutputStream is write-only, so this is not very straightforward - any attempts to look at the Length property of the output stream will throw an exception.

The only solution to this I've ever seen is by applying a filter to the Response object, so that the filter can count the bytes.

A quick Google search landed me here, which seems close to the implementation I remember.

womp
A: 

I had a similar issue. See here

ram