Professional Web Applications Themes

Newbie Question -- Bypass client image caching? - Coldfusion - Advanced Techniques

I'm using cfx_getImage to extract images from SQL Server...works great. The image is used on a person's contact info screen within a standard directory lookup application. However, since the filename of the JPG is always the same (and therefore, the SRC attribute of the IMG tag is the same), you get the same person's picture for any contact info. The picture is only updated when you refresh (F5) the page. Does anyone know how to force the browser to always download the image instead of using its cached copy? Here is what I have already tried: 1. Tried to manually ...

  1. #1

    Default Newbie Question -- Bypass client image caching?

    I'm using cfx_getImage to extract images from SQL Server...works great. The
    image is used on a person's contact info screen within a standard directory
    lookup application.

    However, since the filename of the JPG is always the same (and therefore, the
    SRC attribute of the IMG tag is the same), you get the same person's picture
    for any contact info. The picture is only updated when you refresh (F5) the
    page.

    Does anyone know how to force the browser to always download the image instead
    of using its cached copy? Here is what I have already tried:

    1. Tried to manually flush the cache...(does this happen only at the server
    then?)...
    <cfcache action="flush" expireurl="#PhotoDirectoryURL##PhotoFileName#">

    2. Tried the CFHEADER tag to expire the page:
    <cfheader name="Expires" value="#Now()#">
    <cfheader name="Pragma" value="no-cache">

    Any help is greatly appreciated!

    Thanks,

    Eric


    Eric.NET Guest

  2. #2

    Default Re: Newbie Question -- Bypass client image caching?

    cfcache is a CF server-side function, you can put the HTML for a cf template
    into a temp cache dir on the CF server and that html is used instead of
    processing the CF template each time. So you probably want to stay away from
    that. Try using meta tags instead <meta http-equiv='pragma' content='no-cache'
    /> <meta http-equiv='Cache-Control' content='no-cache' /> This are pretty much
    the same as the response headers, but may make a difference. Is there any way
    in your code to write the image from the server to a unique file name for each
    image? Such as appending it with a userid or record id?

    byron1021 Guest

  3. #3

    Default Re: Newbie Question -- Bypass client image caching?

    Thank you for your reply.

    I tried using the meta tags, but they didn't work. Are those just to keep the
    actual HTML from caching, not necessarily the images?

    I was hoping to avoid using a unique file name for each image to reduce
    clutter, as there is the potential for several hundred images. However, my
    customer just e-mailed me that this issue was becoming a problem, so...I went
    ahead and created the unique file names, and everything works fine.

    Thanks again, Byron,

    Eric


    Eric.NET Guest

Similar Threads

  1. Newbie question: using .net web service with vb6 client
    By geek2geek in forum ASP.NET Web Services
    Replies: 0
    Last Post: November 6th, 05:36 PM
  2. Image Background... your basic newbie question!
    By Jeffro in forum Macromedia Fireworks
    Replies: 1
    Last Post: September 15th, 09:42 PM
  3. Client caching
    By Pål Johansen in forum ASP.NET General
    Replies: 3
    Last Post: August 6th, 08:38 PM
  4. Working with client workstations - newbie question
    By JSM in forum ASP.NET General
    Replies: 7
    Last Post: August 2nd, 01:42 PM
  5. stopping client side caching
    By John Livermore in forum ASP.NET General
    Replies: 2
    Last Post: July 15th, 05:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139