ASP   «Prev  Next»

Lesson 8ASP Response object
ObjectiveDescribe the ASP Response object.

Description of ASP's Response Object

As we have described previously, the browser-server dialog consists of requests from the client and responses from the server. The server replies to browser requests and sends data back to the browser through ASP's Response object.
You have already used one method of this object, Response.Write, in an earlier lesson to write the contents of variables and HTML Form fields byte-by-byte to your browser. You can write larger amounts of data at one time by using output buffering.

Characteristics of the Response Object

As you can see from the summary below, the Response object has more features than the Request object. The features that will be most useful to you in creating Web applications will be explained in the remaining lesson in this module.

The Response Object
Response.collection|property|method
Collections
Cookies Set cookie values
Properties
Buffer Should the page output be buffered?
CacheControl May proxy servers cache the output generated by ASP?
Charset Add the name of the character set to the content-type header.
ContentType Identify the content type for the response.
Expires How long before a page cached on the browser should expire?
ExpiresAbsolute When (date and time) should a page cached on the browser expire?
IsClientConnected Is the client still connected to the server?
Pics Add the value of a PICS (for content rating) label.
Status This is the status line sent by the server.
Methods
AddHeader Add a new HTTP header, and set the name to value.
AppendToLog Annotate the Web server log entry for the original request with a string.
BinaryWrite Send the data without any character-set conversion.
Clear Erase all unflushed HTML output buffered so far.
End Quit processing the ASP file, and return the current result.
Flush Send any buffered output right now.
Redirect Redirect the browser to connect to a different URL than the one requested.
Write Write the value of an ASP variable to the current output.

The Response object has a single collection, Cookies, which is used to set cookie values, as we will explain in the next lesson.
Most of the properties of the Response object are translated into HTTP headers (part of the browser-server data exchange); one of them, ContentType gives the browser information about the data or file being sent.
The next lesson describes how to use the Response object to write browser cookies.