To read the article online, visit

WebDaily: Your daily source for Web Technology Tips and Tricks!

The Response Object

* This article deals with the Active Server Pages Response object

If you're an ASP developer, you've no doubt used the Response object several times. If we had a nickel for each time we've used:

Response.Write "blah"

we'd all be as rich as Bill Gates! Anyway, there are many more useful properties and methods for the Response object that don't get discussed as often on listservs or on ASP web sites. This email will detail some of these properties and methods.

Response.Buffer = TRUE | FALSE
Response.Buffer is a value to set whether or not ASP buffers the code before sending it to the client. For example, if you start your ASP page with Response.Buffer = True, the entire ASP script will be processed before it is sent to the client. If it is set to false (which is the default in ASP 2.0 / ASP 1.0), the client will get the code as it's parsed by the server. (ASP 3.0, by default, has buffer set to True.)

There are certain times when you want to set Response.Buffer = True. If you do a redirect from your ASP page (using JavaScript's or VBScript's document.location property) after HTML content has been sent to the client, Netscape will present an ugly screen stating to the user that he or she is being redirected. If you have Buffering set to true, they won't see this alarming message.

Another use for Buffering is if you do not want to let your user leave the current page until you've finished processing all of the ASP scripts associated with that page. (You may want to do some database calls that you don't want to have interrupted by the user clicking the back button, or click a hyperlink. This is a good time to use the Buffer property.)

Buffering is also a performance enhancer. For more information on how setting Response.Buffer to True will enhance the performance of your ASP pages, be sure to read: Buffer that Output, by Charles Carroll.

Response.Expires = number
Response.Expires sets the time in minutes before a page expires. This determines how long a user's browser will cache the page. There are times when you do not want the page cached. Say that you have an ASP page that the user enters information into a database. Once they type in the information, they are sent to a page which submits the information to the database, then returns them to the same page, showing the updated database data. You want the user to see the data they just entered; however, if the page is cached, they won't see their entry, and will think that their information didn't get entered into the system. To remedy this problem, simply add the following line of code at the top of your ASP file:
Response.Expires = 0

You can also set it to other values. If you have a page that is dynamically updated every 15 minutes, you may wish to set Response.Expires to 15, so the page is only cached for a short 15 minutes.

Learn More About Caching!
To learn more about caching be sure to check out the Caching Article Index. This index contains numerous links to various articles on caching smattered across the Web.

Response.ExpiresAbsolute = [date] [time]
This property is very similar to the Response.Expires property, but rather than setting an elapsed time before the page is no longer cached by a browser, ExpiresAbsolute allows you to set a specific date and/or time when your page will need to be removed from cache.
Here is an example:

'This page will expire on 12/3/98
Response.ExpiresAbsolute = #December 3,1998#

'This page will expire at 1:30 pm on Christmas day, 1998
Response.ExpiresAbsolute = #December 25,1998 13:30#

To subscribe to WebDaily, point your browser to:

Article Information
Article Title: The Response Object
Article Author: Scott Mitchell
Published Date: Saturday, October 24, 1998
Article URL:

Copyright 2019 QuinStreet Inc. All Rights Reserved.
Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers