I have an HttpModule that implements a rewrite stream. This comes from the Stream class. In my HttpModule, I have the following code:
void app_PreRequestHandlerExecute(object sender, EventArgs e) { HttpResponse response = HttpContext.Current.Response; response.Filter = new MyRewriterStream(response.Filter); }
In the stream class, I have the following code that overrides the default recording method:
public override void Write(byte[] buffer, int offset, int count) { string outStr; outStr = UTF8Encoding.UTF8.GetString(buffer, offset, count);
You can just take the length of the string at the second point
source share