Skin Images are not called by httpHandlers or httpModules with ~reference

N

Nemisis

I would like to cache images for my web pages on the client but not
the page content as most of it is dynamically created. I need this
to
work mainly because our Pda website, seems to always download the
images, even if the images are the same, but on a different page?? I
have tried setting the cache settings via IIS, but images only cache
when the querystring is the same (since we use encrypted Id values),
this is hardly the case, and the image is re-downloaded. So i have
tried the following....


1. Write a httpHandler that intercepts calls for gif.ashx, png.ashx
and jpg.ashx images
2. The httpHandler then checks to see if the image is stored in
Response.Cache.
3. If not, then it retrieves the image and stores it in
Response.Cache
4. I then write the following headers, to make sure the image is
stored on the clients machine.


' set cacheability
context.Response.Cache.SetExpires(Date.Now.AddDays(1))
context.Response.Cache.VaryByParams("data") = False
context.Response.Cache.SetValidUntilExpires(False)


context.Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate)


5. I then write the image to the page


In order to get this too work i had to change all my image references
in my css skin files to include the additional .ashx extension, and
include the httpHandler in my web.config file


This all works fine, for ImageButtons, hyperlinks etc, until i come
across a skin file that sets the ImageUrl using ~


Does anyone know why this is??


I also did the same using a HttpModule, but i get the same results.
Any help would be much appricated.
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top