Controlling Response Header Lines

This section describes 2 ways to control HTTP response header line in an ASP script page: Using response.ContentType and response.Charset properties; and using response.AddHeader() method.

When an ASP page is requested, the response header lines will be created by the ASP server. But you can indirectly control some header lines in 2 different ways:

1. Modifying two special properties of the "response" object to set the entity header line Content-Type as shown in the following example:

   response.ContentType = "text/plain"
   response.Charset = "ISO-8859-1"

These two statements will generate the following header line:

Content-Type: text/html; Charset=ISO-8859-1

2. Using the generic method on the "response" object to add any response header lines as shown in the following example:

   response.AddHeader "Author", "Herong Yang"

There seems to be no SetHeader method on the response to let you reset the default header lines generated by the ASP server. You can only add new header lines.

Last update: 2002.

Table of Contents

 About This Book

 ASP (Active Server Pages) Introduction

 IIS (Internet Information Services) 5.0

 MS Script Debugger

 VBScript Language

 ASP Built-in Run-time Objects

 ASP Session

 Creating and Managing Cookies

 Managing Sessions with and without Cookies

 scrrun.dll - Scripting Runtime DLL

Managing Response Header Lines

 HTTP Response Syntax

 HTTP Response Header Lines

Controlling Response Header Lines

 Viewing Response Header Lines

 Response Header Lines for Static Files

 Controlling Response Header Line Example

 Sending Binary Files to Browsers

 Sending Files as Downloads

 Calculation Speed and Response Time

 ADO (ActiveX Data Object) DLL

 Working with MS Access Database

 Guest Book Application Example


 PDF Printing Version