I'm trying to create a HttpModule that changes the Response.Filter
like so
(for this demonstration just set the filter back to itself):
public class ContentTrafficMonitor : IHttpModule
{
public void Init( HttpApplication context )
{
context.BeginRequest += OnBeginRequest;
}
public void Dispose()
{
}
private static void OnBeginRequest( object sender, EventArgs e )
{
var application = (HttpApplication) sender;
application.Response.Filter = application.Response.Filter;
}
}
Doing so sets the transfer encoding of the response to chunked, rather than using the Content-Length
header.
If I remove the line where the Response.Filter
is set, the response does have the Content-Length
header. Our application depends on the Content-Length
header, is there any way to prevent this behavior?