开发者

How to emulate specific HTTP Headers with ASP.NET

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)

How to emulate specific HTTP Headers with ASP.NET

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


Have you tried something like this:

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜