"response" Object - Sending Data to Client
This section provides a tutorial example on how to use the 'response' object provided by the ASP programming interface to send data to the client, the Web browser.
The "response" object is also a rich object. It contains all the information the server
wants to send to the browser, and methods to manage that information:
Cookies: A collections of cookie objects the server wants to send to the browser.
Buffer: A Boolean property indicating whether to buffer the page until the
contents are completed.
Charset: A property representing the character set name in HTTP response header.
ContentType: A property representing the content type name in the HTTP response header.
Expires: A property representing the period of time before the page cached
on a proxy server expires.
IsClientConnected: A Boolean property indicating whether the browser has
disconnected from the server.
Status: A property representing the status in the HTTP response header.
AddHeader name, value: A method to set or change the value of a variable in the HTTP
AppendToLog(string): A method to append the specified string to the log file of the Web server.
BinaryWrite(data): A method to send binary data to the browser.
Clear(): A method to clear any buffered HTML output.
End(): A method to stop add data to the HTML output from both script statements and
static HTML data.
Flush(): A method to sends buffered HTML output immediately to the browser.
Redirect(url): A method to redirect the browser to another URL.
Write(string): A method to write the specified string to the HTML output.
The following ASP page gives you an idea how to use the response object and its buffer
<script language="vbscript" runat="server">
' Copyright (c) 2002 by Dr. Herong Yang
' This program shows how to use the buffer in the response object
response.write("<b>Tests on the response object</b>:</br>")
response.Buffer = true
response.write("Text line 1.<br/>")
response.write("Text line 2.<br/>")
response.write("Text line 3.<br/>")
Text line 2.
As you can see from the output, the first text line was cleared out from the response
buffer by the call to Clear(). The call to End() stopped the Web server to put any more
text to the output. This was why the output only had the second text line.
Last update: 2002.
Table of Contents
About This Book
ASP (Active Server Pages) Introduction
IIS (Internet Information Services) 5.0
MS Script Debugger
►ASP Built-in Run-time Objects
Introduction of ASP Objects
"request" Object - Receiving Data from Client
►"response" Object - Sending Data to Client
"server" Object - Sharing Data across Applications
"application" Object - Sharing Data within an Application
"session" Object - Sharing Data across ASP Pages
Creating and Managing Cookies
Managing Sessions with and without Cookies
scrrun.dll - Scripting Runtime DLL
Managing Response Header Lines
Calculation Speed and Response Time
ADO (ActiveX Data Object) DLL
Working with MS Access Database
Guest Book Application Example
PDF Printing Version