Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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
)
Not applicable.

Parameters

name

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

value

The string to append to the header.

Exception typeCondition

HttpException

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 Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft