开发者

Multiple Headers in asp.net

开发者 https://www.devze.com 2022-12-16 11:36 出处:网络
I\'m running code that seems to hit the \"AppendHeader\" twice in the code. Response.Filter = New DeflateStream(Response.Filter, CompressionMode.Compress, True)

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 requir开发者_Go百科es IIS integrated pipeline mode.

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


What about:

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


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.


To summarize Response.AppendHeader & Response.Headers["Content-encoding"] won't work with IIS6

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号