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

Discussion in 'ASP .Net' started by Nemisis, Aug 8, 2008.

  1. Nemisis

    Nemisis Guest

    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.
    Nemisis, Aug 8, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ian Turner

    Virtual Paths and HttpModules

    Ian Turner, Oct 26, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    364
    Dmitry Andreev
    Oct 26, 2003
  2. matt

    HttpHandlers and HTTPModules

    matt, Apr 19, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    2,504
  3. =?Utf-8?B?U3RlZW4gVMO4dHRydXA=?=

    Static variables in httphandlers/httpmodules

    =?Utf-8?B?U3RlZW4gVMO4dHRydXA=?=, Nov 19, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,063
    Hans Kesting
    Nov 19, 2004
  4. tshad
    Replies:
    0
    Views:
    333
    tshad
    Mar 3, 2006
  5. Ray
    Replies:
    0
    Views:
    301
Loading...

Share This Page