views:

39

answers:

1

I Have a specific set of HTTP response headers I'm trying to recreate in ASP.NET. Here is how it looks in Fiddler (Raw):

HTTP/1.1 200 OK
Content-Length: 570746
Content-Type: audio/wav
Last-Modified: Wed, 19 May 2010 00:44:38 GMT
Accept-Ranges: bytes
ETag: "379d676ecf6ca1:3178"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Tue, 05 Oct 2010 18:35:18 GMT

Here is how it looks on the Headers tab (same data. Different view)
Fiddler Response Header View

I am trying to recreate the same set of headers (different values of course) with code, on an ASP.NET page. The biggest problem is with the cache settings and the ETag. It usually shows some "private" or similar cache setting and no ETag value, even though I'm trying to set it explicitly with

Response.Cache.SetETag
A: 

Have you tried something like this:

if (Response.Headers("ETag") == null) Response.AddHeader("ETag", "379d676ecf6ca1:3178") else Response.Headers("ETag") = "379d676ecf6ca1:3178";

tgolisch
How do I make sure there are no `cache` segments in the header?
Ron Harlev
The "cache" segments are added by IIS. This article on SO does a pretty good job of discussing Cache and Private: http://stackoverflow.com/questions/3492319/private-vs-public-in-cache-control
tgolisch