Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > refresh image in asp.net page

Reply
Thread Tools

refresh image in asp.net page

 
 
=?Utf-8?B?cmFtZW5kcmE=?=
Guest
Posts: n/a
 
      12-01-2005
how to refresh a image control to pick up the latest image file on a asp.net
page. i am generating a image based on the input from the user and displaying
it on the page through image control. The problem is that i am not able to
get the latest image on the page, it keeps showing the old page. But when i
hit the refresh button on the toolbar it correctly gets the latest image and
displays it in the control. But that has another problem, it pops up a dialog
asking user whether he wants to retry or cancel...

so in short i need to implement some logic so that the image control is
refreshed when the image changes (i know exactly when the image changes) and
dont popup any dialog box for user input.

any help is greatly appreciated

thanks, Ramendra
 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      12-01-2005
You can trick the browser into reloading the image from the server by adding
a random query parameter to the image url. I am using a javascript call that
produces the millisecond part of the current time.

Eliyahu

"ramendra" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> how to refresh a image control to pick up the latest image file on a
> asp.net
> page. i am generating a image based on the input from the user and
> displaying
> it on the page through image control. The problem is that i am not able to
> get the latest image on the page, it keeps showing the old page. But when
> i
> hit the refresh button on the toolbar it correctly gets the latest image
> and
> displays it in the control. But that has another problem, it pops up a
> dialog
> asking user whether he wants to retry or cancel...
>
> so in short i need to implement some logic so that the image control is
> refreshed when the image changes (i know exactly when the image changes)
> and
> dont popup any dialog box for user input.
>
> any help is greatly appreciated
>
> thanks, Ramendra



 
Reply With Quote
 
 
 
 
Joerg Jooss
Guest
Posts: n/a
 
      12-01-2005
Eliyahu Goldin wrote:

> You can trick the browser into reloading the image from the server by
> adding a random query parameter to the image url. I am using a
> javascript call that produces the millisecond part of the current
> time.


Or unleash the full power of HTTP by sending a Cache-Control: no-cache
header

Cheers,
--
http://www.joergjooss.de
(E-Mail Removed)
 
Reply With Quote
 
=?Utf-8?B?cmFtZW5kcmE=?=
Guest
Posts: n/a
 
      12-02-2005
Hi Eliyahu,

I have added the query string parameter (page.aspx?a=test) to the image url
but still the image doesn;t seem to get refreshed with the new one.

please clarify you suggestion.

thanks, Ramendra

"Eliyahu Goldin" wrote:

> You can trick the browser into reloading the image from the server by adding
> a random query parameter to the image url. I am using a javascript call that
> produces the millisecond part of the current time.
>
> Eliyahu
>
> "ramendra" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > how to refresh a image control to pick up the latest image file on a
> > asp.net
> > page. i am generating a image based on the input from the user and
> > displaying
> > it on the page through image control. The problem is that i am not able to
> > get the latest image on the page, it keeps showing the old page. But when
> > i
> > hit the refresh button on the toolbar it correctly gets the latest image
> > and
> > displays it in the control. But that has another problem, it pops up a
> > dialog
> > asking user whether he wants to retry or cancel...
> >
> > so in short i need to implement some logic so that the image control is
> > refreshed when the image changes (i know exactly when the image changes)
> > and
> > dont popup any dialog box for user input.
> >
> > any help is greatly appreciated
> >
> > thanks, Ramendra

>
>
>

 
Reply With Quote
 
=?Utf-8?B?cmFtZW5kcmE=?=
Guest
Posts: n/a
 
      12-02-2005
I am new to Asp.net and therefore i am not able to understand your suggestion
or i am doing it in wrong way.

-RK

"Eliyahu Goldin" wrote:

> You can trick the browser into reloading the image from the server by adding
> a random query parameter to the image url. I am using a javascript call that
> produces the millisecond part of the current time.
>
> Eliyahu
>
> "ramendra" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > how to refresh a image control to pick up the latest image file on a
> > asp.net
> > page. i am generating a image based on the input from the user and
> > displaying
> > it on the page through image control. The problem is that i am not able to
> > get the latest image on the page, it keeps showing the old page. But when
> > i
> > hit the refresh button on the toolbar it correctly gets the latest image
> > and
> > displays it in the control. But that has another problem, it pops up a
> > dialog
> > asking user whether he wants to retry or cancel...
> >
> > so in short i need to implement some logic so that the image control is
> > refreshed when the image changes (i know exactly when the image changes)
> > and
> > dont popup any dialog box for user input.
> >
> > any help is greatly appreciated
> >
> > thanks, Ramendra

>
>
>

 
Reply With Quote
 
=?Utf-8?B?cmFtZW5kcmE=?=
Guest
Posts: n/a
 
      12-02-2005
Hi Eliyahu,

thanks a lot it solved my problem.

thanks, Ramendra

"Eliyahu Goldin" wrote:

> You can trick the browser into reloading the image from the server by adding
> a random query parameter to the image url. I am using a javascript call that
> produces the millisecond part of the current time.
>
> Eliyahu
>
> "ramendra" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > how to refresh a image control to pick up the latest image file on a
> > asp.net
> > page. i am generating a image based on the input from the user and
> > displaying
> > it on the page through image control. The problem is that i am not able to
> > get the latest image on the page, it keeps showing the old page. But when
> > i
> > hit the refresh button on the toolbar it correctly gets the latest image
> > and
> > displays it in the control. But that has another problem, it pops up a
> > dialog
> > asking user whether he wants to retry or cancel...
> >
> > so in short i need to implement some logic so that the image control is
> > refreshed when the image changes (i know exactly when the image changes)
> > and
> > dont popup any dialog box for user input.
> >
> > any help is greatly appreciated
> >
> > thanks, Ramendra

>
>
>

 
Reply With Quote
 
alexstephens alexstephens is offline
Junior Member
Join Date: Dec 2007
Posts: 1
 
      12-22-2007
I think what is meant is that the actual image url i.e "www.yoursite.com/images/myImage.jpg" should be appended with something like "www.yoursite.com/images/myImage.jpg?uygwefug=1"

Basically the browser is seeing the same image so returns it from cache so by adding random text on the end your forcing the browser to retrive the new image.

I have had to do this myself and it worked well, the only thing to watch for is if testing to see if the image actually exists first, it will fail if you have params on it.
 
Reply With Quote
 
edy tang edy tang is offline
Junior Member
Join Date: Oct 2009
Posts: 1
 
      10-05-2009
If you add the current time to the link, the link will be unique each time "myImage.jpg?myTime=" & now(). So, it will be refreshed each time.
 

Last edited by edy tang; 10-05-2009 at 10:38 PM..
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refresh image in asp:Image-control =?Utf-8?B?TWlybw==?= ASP .Net 6 02-27-2007 09:48 PM
JSP: Session parameters vanish on refresh. How do I keep them on refresh? Per Magnus L?vold Java 1 10-08-2004 02:52 PM
How do i refresh a datagrid from a pop up window without having to refresh the whole page? Pkenty ASP .Net Web Controls 0 05-28-2004 07:06 AM
using refresh button on the menu bar to refresh two frames. Jawahar Rajan ASP General 1 10-01-2003 09:20 PM
Problem with refresh button breaking automatic refresh brian lanning ASP .Net 0 07-29-2003 07:57 PM



Advertisments