locked
Response Headers Re-ordering RRS feed

  • Question

  • User-1186954494 posted

    I have this crazy requirement to push the Date response header to the top. In IIS, it is never the first one immediately after the status line. I have tried using a native module (C#) but Date header is not in HttpContext.Current.Response.Headers by the time PreSendRequestHeaders gets triggered. It should be getting added down the pipeline. Not sure how to go about this? Any pointers will be appreciated.

    Thursday, November 8, 2012 1:00 AM

All replies

  • User1779161005 posted

    I've never tried this, but perhaps if you disable buffering then you could order your headers based upon when you write them.

    Do you mind explaining why you need to order them?

    Also, you're aware the spec says this about HTTP headers:

    "The order in which header fields with differing field names are received is not significant."

    Thursday, November 8, 2012 9:55 AM
  • User-1186954494 posted

    Thanks for the reply. I disabled buffering but it does not work. Of course, the issue is that Date header is not even in the collection by the time the event is triggered. I suspect Date is added in somewhere down the pipeline by some other component.

    Anyways, I do understand the order of headers must not matter, as per the spec but there are some dumb client apps out there written probably in 1990 that expect a few things in terms of the header sequence. That is something I cannot change but was just wondering if IIS/ASP.NET has the flexibility to reorder things when needed, especially given the fact that .NET modules are first class citizens in IIS 7 integrated pipeline mode. I was hoping to do something with a HTTP module.

    Thursday, November 8, 2012 11:36 AM
  • User1779161005 posted

    Bummer. G'dluck and if you find a solution let us know :)

    Thursday, November 8, 2012 11:57 AM