ASP Response Object : Expires Property

The Expires property specifies the length of time (in minutes) before a page cached on a browser expires. If the user returns to the same page before it expires (and the page is allowed to be cached), the cached version is displayed.

Example:

  <% Response.Expires = 15 %>
This will result in the page expiring after 15 minutes. If you set the Expires property more then once on a single page, the server will use the shortest time period.

When you set the Expires property, IIS creates a HTTP header based on the server's clock1. If the clock on the end user's machine is faster (earlier) then the system time on the server, then setting the minutes to 0 will not have the effect of immediately expiring the page. Instead, you should use a large negative number2.

Alternatively, you can use the Response.ExpiresAbsolute property to achieve immediate expiration of a page. Setting the ExpiresAbsolute property to a date from the beginning of the century will guarantee immediate expiration.

See the Tips & Hints section of Response.CacheControl for more examples of using the Expires property.


Back to the ASP Response Object
Back to ASP Objects
1 This header is actually the server's current clock time plus the number of minutes specified in the Expires property.
2 I suggest a value of about -1000 (over half a day) to account for users from different time zones.

Resources:
http://www.devguru.com/
http://msdn.microsoft.com/asp/

All code is my own (but has filed for separation).

Log in or register to write something here or to contact authors.