maX
maX

Reputation: 742

images in no cache pages

I have this code in my secure aspx pages

        Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.Cache.SetValidUntilExpires(false);

Questions: 1. What happens to the images in these pages? Will the images be downloaded for each request? 2. If the images are downloaded everytime, is there a way to cache only the images, while rest of the content is not cached?

My only concern is the time consumed for each request to these pages. If the images are downloaded each time, the pages will take time to load for slower internet connections.

Upvotes: 0

Views: 408

Answers (1)

Kelsey
Kelsey

Reputation: 47766

The images will be cached. They are just links to images in your page but done as seperate requests to server. Whatever you set in the response of the aspx page will not affect them. The client browser will do a lot of the caching with static links to images automatically. Also, IIS can be setup to automatically cache images. I am not sure if it does by default.

If you are using a handler to fetch the image from a DB though the caching will most likely not occur.

Upvotes: 2

Related Questions