Valhalla Legends Forums Archive | Web Development | Changing header data on IIS with ASP

AuthorMessageTime
Spht
I need to change the HTTP headers for a ASP page I'm working on.  Specifically, Connection needs to be changed from Keep-Alive (which is what it's defaulting to) to close.  Also, Content-Type needs to be changed.

Edit: PHP's header() seems to let you do this.  Is there ASP equivilent?

Answer:  Response.ContentType for changing Content-Type and Response.AddHeader "Connecton" can be used for adding that header (note it does not overwrite matching header).
February 4, 2006, 3:19 AM
Grok
To write, use Response.AddHeader:
<% Response.AddHeader "CustomHeader", "CustomValue" %>

To read:
<% ReturnedValue = Request.ServerVariables("HTTP_CustomHeader") %>

Found this in Platform SDK help, did not test it myself.
February 6, 2006, 9:35 PM

Search