This project is read-only.

Content is duplicated or triplicated when a blank HttpModule is present



Reproduce by creating a blank HttpModule which adds a no-op event handler to PreSendRequestHeaders
public class BlankModule : IHttpModule {

    void IHttpModule.Init(System.Web.HttpApplication context) {
        //Having any event handlers registered for this event causes cache duplication during the Filter execution
        context.PreSendRequestHeaders -= context_PreSendRequestHeaders;
        context.PreSendRequestHeaders += context_PreSendRequestHeaders;
    void IHttpModule.Dispose() { }
    protected void context_PreSendRequestHeaders(object sender, EventArgs e) {}
Make sure you register it in Web.Config:
       <add name="BlankModule" type="BlankModule"/>
Place a breakpoint on OutputCacheFilter.cs after the following lines of code, and you can inspect the response duplication directly (it's also visible in-browser)
        var output = _filter.GetContents(response.ContentEncoding);

Register another copy of the module, and you'll get tripled responses, not just doubled.

This prevents ImageResizer ( from being used with Contrib.Cache.


urbanit wrote Jul 3, 2013 at 3:53 PM

Is there any solution available?

sebastienros wrote Jul 9, 2013 at 6:41 PM

I have tried with the latest 1.x tip of Orchard and I can't reproduce the issue. My filters get called only once, despite the fact that the event is called twice.

NathanaelJones wrote Jul 9, 2013 at 7:21 PM

The filters don't necessarily get called twice; but the response is duplicated.

sebastienros wrote Jul 9, 2013 at 9:30 PM

I can't get it duplicated either, though I have seen it on several customers so I don't question the fact that it happens, just the repro is not working for me. I will try again.

urbanit wrote Jul 10, 2013 at 8:11 AM

Seems to be corrected with the new OuptuCache! Thanx @SebastienRos