![]() |
![]() |
|
![]() |
Response.Expires Implementation and Usage © 2003 David Wright http://www.icgroupinc.com Preface This article addresses some wide-spread misunderstanding of the implementation and use of the Response.Expires property. Introduction There is a widely spread misunderstanding of the implementation of the Response.Expires property. This, in its turn, has lead to many questions and problems with this property. I'm not certain why this misunderstanding has occurred, because the Microsoft documentation is quite clear. Implementation of Response.Expires The value assigned to Response.Expires is a value in minutes. When the page is sent to the client computer, that value is added to the server's system time, and the expiry date of the page (in the http header) is set to the resulting date and time. On the client-side browser, the expiry date/time is compared to the local system time to determine if the page has expired and should be requested again. The implementation of this property affects only the HTTP header sent to the client. It has no documented or suggested effect on what should happen in the client-side cache based on the setting of this property. That may always be safely assumed to be browser-dependent. As long as the browser implements the handling of the expiry date correctly, everything should work properly. Usage of Response.Expires If you want a page to expire in 15 minutes, you would set the value of Response.Expires to 15. This much is widely understood. What is not understood is how to expire a page immediately. If you set the value to 0, the page will expire immediately only if the client system time and the server system time are identical, or if the client system time is greater than the server system time. If you set the value to -1, that is still not good enough, because if the client system time is, say, ten minutes behind the server system time, then from the point of view of the client computer, the page expires 9 minutes in the future. The value can, however, be assigned any valid integer value, so it can be set to large negative values. I arbitrarily choose: Response.Expires = -6000 to set the expiration date to 100 hours in the past. That sets the page expiry date to slightly more than 4 days ago. That is enough to make the page expire immediately on any computer on the planet whose system clock is less than 3 days off. Artifacts of mis-use If you routinely use a value of 0 and -1 and expect that to cause the page to expire immediately, assuming that having the page never read from the cache is important to the integrity of the web-site, what you will get is intermittent bugs reported from the field that indicate that the page is not refreshing correctly. Typically, this is dismissed as some sort of random caching bug when in fact it is a symptom of a badly set clock combined with a mis-implementation of this server-side parameter. Summary I have explained the correct implementation and usage of the Response.Expires property in an attempt to correct a widely held misinterpretation of what this property does. Aside from the usage as described here, web developers should make no assumptions about other activity performed by this property. For example, one should not assume that it will prevent a page from being cached. Whether or not the page caches is up to the browser. What it can do is set the expiry date to an offset from the current time - no more or less. Discussion of this article |
![]() Feedback | Paradox Day | Who Uses Paradox | I Use Paradox | Downloads ![]() |
|
![]() The information provided on this Web site is not in any way sponsored or endorsed by Corel Corporation. Paradox is a registered trademark of Corel Corporation. ![]() |
|
![]() Modified: 03 Feb 2004 Terms of Use / Legal Disclaimer ![]() |
![]() Copyright © 2001- 2004 Paradox Community. All rights reserved. Company and product names are trademarks or registered trademarks of their respective companies. Authors hold the copyrights to their own works. Please contact the author of any article for details. ![]() |
![]() |
|