When you add custom headers through IIS or using Response.AddHeader, you might expect them to be available in the ServerVariables collection. To understand why these values are not available to the requested ASP script, we need to understand how HTTP connections to ASP pages evolve. First, the client makes a request for an ASP page. At this point, it sends its request headers to the server, populating Request.ServerVariables() and other collections. Once it has this information, IIS sends back a response, including standard and any custom headers. The HTML page, or Excel spreadsheet, or ZIP is rendered to the client and/or offered for download. At no point are the headers associated with the response object available via the request object.
Custom headers are for sending information to the browser, not for retrieving it. If you're sending custom headers, e.g.:
<% Response.AddHeader "blah", "blah" %> |
Then why would you need to do this:
<% Response.AddHeader "blah", "blah" Response.Write Request.ServerVariables("HTTP_blah") %> |
When you already know the content of the header? The above is logically the same as:
<% Response.AddHeader "blah", "blah" Response.Write "blah" %> |
See
KB #270645 for information from the source.