Name

ClearHeaders

Synopsis

Response.ClearHeaders(  )

Clears the HTTP headers from the current output stream.

Parameters

None

Example

The example sets the HTTP Content-Type header to “text/xml”, clears the HTTP headers by calling the ClearHeaders method, and then writes the value of the Response.ContentType property to the Text property of the Message ASP.NET Label control. The displayed Content-Type is the default of “text/html”.

Sub Page_Load(  )
   Response.AppendHeader("Content-Type", "text/xml")
   Response.ClearHeaders(  )
   Message.Text = Response.ContentType
End Sub

Notes

The ClearHeaders method clears only the HTTP response headers, not the buffered content.

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.