Replacing Response.Add_Header()


This article applies to older applications being moved to Alpha Anywhere. This information does not apply to new applications built with Alpha Anywhere.

This article applies to developers who are migrating applications from Alpha Five V10 or older to a newer release of Alpha Anywhere.

Response.Add_Header() was marked as deprecated in the V10 release and has been removed in V11. Any code which attempts to use this method will generate an error and must be updated.

Sending headers at part of the Response from V11 forward is done using the Response.Headers property. Response.Headers is a .Net System::Collections::Specialized::NameValueCollection, and it is functionally equivalent to ASP.Net's Response.Headers property.

Adding a header to the Response.Headers NameValueCollection object is done using either the Add or Set method, both of which take a simple name and value as their arguments.

  1. The Add method allows multiple values to be stored in a single header. If the specified header name already exists, the specified value is added to the existing comma-separated list of values in the form "value1,value2,value3".

  2. The Set method overwrites the existing list of values, if any, with the specified value.


'send a custom header back to the client
Response.Headers.Set("X-MyCustomHeader","This is a custom header")
'send two values in the same header
Response.Headers.Set("X-MyOtherHeader","some value")

Additional Documentation