This documentation is archived and is not being maintained.

HttpResponse.AppendHeader Method

Adds an HTTP header to the output stream.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

public void AppendHeader (
	string name,
	string value
public void AppendHeader (
	String name, 
	String value
public function AppendHeader (
	name : String, 
	value : String



The name of the HTTP header to add to the output stream.


The string to append to the header.

Exception typeCondition


The header is appended after the HTTP headers have been sent.

If you use the AppendHeader method to send cache-specific headers and at the same time use the cache object model (Cache) to set cache policy, HTTP response headers pertaining to caching (Cache-Control, Expires, Last-Modified, Pragma, and Vary) might be deleted when the cache object model is used. This behavior enables ASP.NET to maintain the most restrictive settings. For example, consider a page that includes user controls. If those controls have conflicting cache policies, the most restrictive cache policy will be used. If one user control sets the header " Cache-Control: Public " and another sets the more restrictive header " Cache-Control: Private " via calls to SetCacheability, then the " Cache-Control: Private " header will be sent with the response.

The following code example calls the AppendHeader method to add a custom header to the HttpResponse object sent to the requesting client.

Response.AppendHeader("CustomAspNetHeader", "Value1");

get_Response().AppendHeader("CustomAspNetHeader", "Value1");

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0