ASP.NET 2.0 image caching

  • Thread starter Thread starter Amelyan
  • Start date Start date
A

Amelyan

Is there a way to cache an image without having to cache the whole page
(aspx) or the whole control (ascx) where the image is located?

Thanks,
-Boris
 
Hello Amelyan,
Is there a way to cache an image without having to cache the whole
page (aspx) or the whole control (ascx) where the image is located?

An image is not embedded in a control or page -- it's just a reference to
another file on the web sever which reqires another HTTP request to be fetched.
All you need to do is configure your web server to mark these files as cacheable,
if you find that this isn't the default behaviour or require more granular
control over your files' cacheability.

Cheers,
 
Hello Amelyan,
How can I mark my whole "Images" directory as cachable in IIS 6.0?

I don't have an IIS 6.0 available right now, but assuming it hasn't changed
since 5.x, you perform the following steps:

1. Run the IIS admin applet
2. Navigate to the image folder in the tree view
3. Open the folder's context menu and select Properties
4. Here, you can set an expiration date for all files contained in that folder.
You can also choose to set any other HTTP header, such as CacheControl: no-cache.

Hope that helps.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top