Cache Dynamically Generated Images for Quick Page Response

If you have an image gallery with dynamically generated thumbnails, you should make sure to tell the browser to cache the thumbnails. If you don’t, the page will download each image every time the browser visits, which stresses the CPU unnecessarily and causes the page to take longer to load. In contrast, when images are in the browser’s cache, the page loads far faster.

If your image gallery contains multiple pages, the chances are good that users will visit the same page more than once. For returning visitors, the chances are even higher.

To enable browser caching, set the Last-Modified header in the .aspx or .ashx that you use to generate the thumbnails, using a date value so that the page always appears unmodified to the browser. Here’s an example that sets the last modified date to one year ago:

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: