On 10/20/06 10:35, Mark Denardo wrote:
Quote:
"Mark E. Hansen" <meh@NOSPAMunify.comwrote in message
news:ufgSmvG9GHA.1168@TK2MSFTNGP03.phx.gbl...
Quote:
>On 10/20/06 10:04, Mark Denardo wrote:
Quote:
>>I created a Web Image "<asp:Image ID="Image1" ..." that my code behind
>>set
>>to a certain image file say image1.jpg
>>>
>>=Image1.ImageUrl = "<rel_path>/image1.jpg";
>>>
>>which set the image ok, but then I replaced that image file with another
>>image file and gave it the same name "image1.jpg". But my web app when
>>it
>>loads the image when I run the page still shows the original picture that
>>I
>>deleted and replaced with the new one, even though I restarted the entire
>>app. I'm thinking that the image is cached in some way and needs to be
>>refreshed somehow, so I tried adding the following:
>>>
>>=Image1.ImageUrl = "<rel_path>/image2.jpg"; (button click 2)
>>=Image1.ImageUrl = "<rel_path>/image1.jpg"; (button click 1)
>>>
>>These are called by button clicks so I can see the results dynamically.
>>And
>>what I see is when I click button2, that image shows the second image
>>correctly, and when I click button1, it again shows the old image I
>>deleted
>>over a day ago.
>>>
>>How do I make my page refresh or flush that image?? (I've started and
>>stopped the app. a dozen times over the past day and a half and it still
>>has
>>the old photo I deleted lingering in memory somewhere and doesn't want to
>>let it go.)
>>>
>>>
>>
>I don't think it's the application - it's the browser. Try clearing your
>browser cache and see what it displays then.
>
How do I clear the cache? I'm running the app out of VS2005. When I stop
the app, the browser shuts down, shouldn't that clear any cache?
>
>
Closing the browser does not clear its cache (but this is up to the
browser). Each browser has its own mechanism for doing this. Knowing
which browser you're using may help - but have a look at the browser
settings - you may be able to find it on your own.
Keep in mind that the content (an image in this case) will be sent to
your client (usually a browser) with an expiration date/time. The client
is welcome to cache the content until it expires, at which time it should
clear the content from its cache.
Once you get clear on this, your next question will be "how do I set the
expiration on my image..." ;-)
Before you do this, consider the consequences. For example, caching the
image really improves performance. If the image doesn't change very often,
it's probably much better if you let the client cache it. If, on the other
hand, your image is expected to change all the time (like a graph of a stock
value) then you probably need it to expire in relatively short order, like
within just a few minutes.
As to how to get your application to specify the expiration you want for
a particular image, I don't know - I'll leave that for someone else to
answer.
Hope this helps,