473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Image Control not refreshing

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.)
Oct 20 '06 #1
6 4912
On 10/20/06 10:04, Mark Denardo wrote:
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.
Oct 20 '06 #2
"Mark E. Hansen" <me*@NOSPAMunify.comwrote in message
news:uf**************@TK2MSFTNGP03.phx.gbl...
On 10/20/06 10:04, Mark Denardo wrote:
>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?
Oct 20 '06 #3
"Mark E. Hansen" <me*@NOSPAMunify.comwrote in message
news:uf**************@TK2MSFTNGP03.phx.gbl...
On 10/20/06 10:04, Mark Denardo wrote:
>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.
Mark, I figured out how to clear the cache and this solved the problem.
(although this now raises another problem, but I'll have to think about it)

Thanks
Oct 20 '06 #4
On 10/20/06 10:35, Mark Denardo wrote:
"Mark E. Hansen" <me*@NOSPAMunify.comwrote in message
news:uf**************@TK2MSFTNGP03.phx.gbl...
>On 10/20/06 10:04, Mark Denardo wrote:
>>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,
Oct 20 '06 #5
Mark Denardo wrote:
"Mark E. Hansen" <me*@NOSPAMunify.comwrote in message
news:uf**************@TK2MSFTNGP03.phx.gbl...
>On 10/20/06 10:04, Mark Denardo wrote:
>>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.

Mark, I figured out how to clear the cache and this solved the problem.
(although this now raises another problem, but I'll have to think about it)

Thanks

You can add a version counter to the url:

Image1.ImageUrl = "<rel_path>/image1.jpg?v=" + version.ToString();

The argument will of course be ignored by the server when the image is
requested, but it makes the url unique for each version.
Oct 21 '06 #6
The versioning worked, thanks.

"Göran Andersson" <gu***@guffa.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Mark Denardo wrote:
>"Mark E. Hansen" <me*@NOSPAMunify.comwrote in message
news:uf**************@TK2MSFTNGP03.phx.gbl...
>>On 10/20/06 10:04, Mark Denardo wrote:
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.

Mark, I figured out how to clear the cache and this solved the problem.
(although this now raises another problem, but I'll have to think about
it)

Thanks


You can add a version counter to the url:

Image1.ImageUrl = "<rel_path>/image1.jpg?v=" + version.ToString();

The argument will of course be ignored by the server when the image is
requested, but it makes the url unique for each version.

Oct 22 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ken | last post by:
How does IE6 control the display of images? I change the content of a image file image1.jpg without changing the file name. Then jump to a new page to display it. IE6 does not displays the...
2
by: jdi | last post by:
Hello, I have a seemingly basic question about ASP.NET. I would like to create a page containing an image, which keeps swapping the url of the image source, without refreshing the entire page. ...
0
by: Jeronimo Bertran | last post by:
Hi, I have a page that includes an image that uses an image map. When the user clicks on a button, the image needs to be refreshed and the map needs to be updated without refreshing the entire...
6
by: Suraj Joneja | last post by:
Hi All, I've an image control on my ASP.net page. This displays an image named 'Logo.jpg' in the location '~\Images'. Another application can change this image. It can select any image and...
16
by: Nicky | last post by:
I am using Visual C# 2005 and I need help creating a filter that will turn a picture black and white. This code I have so far is: byte red, green, blue, avg, newColor; int x; int y; ...
0
by: PeterKellner | last post by:
I have an asp.net 2.0 Image control that I have surrounded with the appropriate atlas:UpdatePanel tags. The Image control referencs an aspx page whose only job is to output an Image. (it forms...
6
by: Mark Denardo | last post by:
My question is similar to one someone posted a few months back, but I don't see any replies. Basically I want to be able to have users upload photos and save them in a database (as byte data)...
9
by: Mark Denardo | last post by:
This is related to another post I submitted, but I'll be more precise this time. I have a web page that contains an Image webcontrol that loads its image by: Image1.ImageUrl="<username>.jpg",...
6
by: gopim | last post by:
hi, i have a problem. i am saving bitmaptextimage dynamically in data/image1.jpg every time when i redirect to the image.aspx page and i am assignning this image url to the image control.but image...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.