views:

56

answers:

2

I'm running code that seems to hit the "AppendHeader" twice in the code.

Response.Filter = New DeflateStream(Response.Filter, CompressionMode.Compress, True)
Response.AppendHeader("Content-encoding", "deflate")

...

Response.AppendHeader("Content-encoding", "deflate")

I have tried using the following....

Response.Headers("Content-encoding") = "deflate"

But it says

This operation requires IIS integrated pipeline mode.

How do I check for a headers existence, and overwrite it rather than appending it.

A: 

What about:

if (!(Response.Headers["Content-encoding"] ?? "").Contains("deflate"))
{
    Response.AddHeader("Content-encoding", "deflate");
}
Rubens Farias
A: 

How about running your app in IIS Integrated Mode? It's a setting on the AppPool in IIS Manager.

Also, you can use Fiddler to help debug the headers.

RickNZ