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.
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.
None
0 Points
2 Posts
Response Headers Re-ordering
Nov 08, 2012 01:00 AM|200OK|LINK
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.
All-Star
20376 Points
6505 Posts
ASPInsiders
MVP
Re: Response Headers Re-ordering
Nov 08, 2012 09:55 AM|BrockAllen|LINK
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."
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
None
0 Points
2 Posts
Re: Response Headers Re-ordering
Nov 08, 2012 11:36 AM|200OK|LINK
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.
All-Star
20376 Points
6505 Posts
ASPInsiders
MVP
Re: Response Headers Re-ordering
Nov 08, 2012 11:57 AM|BrockAllen|LINK
Bummer. G'dluck and if you find a solution let us know :)
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/