views:

310

answers:

1

First, a little background. I have written a custom HTTP compression module for ASP.NET. My development machine has Windows 7 Ultimate, which comes with IIS7. My production environment uses IIS6.

The problem I'm having is, Resource Expert Droid (redbot.org) tells me that I need to add a header to my response to properly support compression: "Vary: Accept-Encoding"

On IIS7 in integrated mode, it works properly. However, in classic mode, which is how my application ultimately runs, I cannot get my code to output this header using any of Response.AppendHeader(), Response.Cache.SetVaryByCustom(), or Response.Cache.VaryByHeaders.

I'm using a wildcard handler mapping, so ASP.NET sees all requests even in classic mode.

+1  A: 

I realize you said you tried this already, but here's the usual approach:

this.Response.Cache.SetVaryByCustom("Accept-Encoding");

You might try calling that method late in the life cycle, such as from End_Request in an HttpModule.

If that doesn't work, unfortunately, in IIS6, you will need to use an ISAPI to set custom HTTP headers.

FWIW, the built-in compression system should set that header automatically for you.

RickNZ