Name

Expires — Response.Expires[=intNumMinutes ]

Synopsis

The Expires property specifies the length of time (in minutes) that the client machine will cache the current page. If the user returns to the page within the amount of time set for the Expires property, the user will view the cached version of the page. If the Expires property is not set, content expiration set for the virtual directory (through the Properties page for the virtual directory on the Microsoft Management Console) will be used. Its default is 24 hours.

Parameters

intNumMinutes

The number of minutes you wish the client's browser to cache the current page

Notes

If you wish to prevent the client's browser from caching the page, use a value of for intNumMinutes. Doing so will force the client to rerequest the page from the web server every time the client navigates to the page.

If you attempt to set the Expires property more than once in a script, the shortest setting is used. For example, the page that includes the following script will result in the client caching the page for five minutes, even though the last setting of the Expires property is 20 minutes:

<% 

Response.Expires = 10
Response.Expires = 5
Response.Expires = 20

%>

Like other properties that result in a change to the HTTP response header values, the Expires property must be set before the server sends the <HTML> tag to the client unless the response is buffered.

Get ASP in a Nutshell, 2nd Edition 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.