I have been working in ASP.NET MVC for a while now, but one thing that has confused me about it is the difficulty involved in modifying HTTP Headers. It is simple enough to add headers (Response.AppendHeader(...);
), and it is very (almost too) simple to remove all headers (Response.ClearHeaders();
). But when it comes to modifying and deleting individual headers, there's trouble.
What is the technical reason behind the http headers collection being more than (essentially) a simple Dictionary<string, string>
that gets written to the response stream? Why is it so easy to remove all, but impossible to remove an individual?
Note - I am not only concerned with running it on the server (using IIS 7, integrated pipeline mode), but also in development (using Cassini).