473,411 Members | 2,230 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,411 software developers and data experts.

Refresh Page

Hello.

I have such problem:
I have ImageButton on my form which is attached to some image like
"image.jpg", now when I change image file (physically file) with some other
file with the same name my page shows the old image until I click "Refresh"
button of the browser.
So how can I refresh web form from code?
Or may be there is some other way to solve this problem?

Thank you.
Nov 19 '05 #1
6 3652
The image gets cached on client side. You can trick the browser onto
refreshing the image by adding a random number to the image url. For example
image.jpg?1234

Eliyahu

"David" <da*********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hello.

I have such problem:
I have ImageButton on my form which is attached to some image like
"image.jpg", now when I change image file (physically file) with some other file with the same name my page shows the old image until I click "Refresh" button of the browser.
So how can I refresh web form from code?
Or may be there is some other way to solve this problem?

Thank you.

Nov 19 '05 #2
No! It's imposable.
Is there any other way?

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:e2****************@TK2MSFTNGP14.phx.gbl...
The image gets cached on client side. You can trick the browser onto
refreshing the image by adding a random number to the image url. For
example
image.jpg?1234

Eliyahu

"David" <da*********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hello.

I have such problem:
I have ImageButton on my form which is attached to some image like
"image.jpg", now when I change image file (physically file) with some

other
file with the same name my page shows the old image until I click

"Refresh"
button of the browser.
So how can I refresh web form from code?
Or may be there is some other way to solve this problem?

Thank you.


Nov 19 '05 #3
Yes, in the code-behind:

Response.ExpiresAbsolute = DateTime.Now.AddDays (-1);
Response.Cache.SetCacheability (System.Web.HttpCacheability.NoCache);

Response.AppendHeader ("Pragma", "no-cache");
Eliyahu

"David" <da*********@hotmail.com> wrote in message
news:OE**************@TK2MSFTNGP14.phx.gbl...
No! It's imposable.
Is there any other way?

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:e2****************@TK2MSFTNGP14.phx.gbl...
The image gets cached on client side. You can trick the browser onto
refreshing the image by adding a random number to the image url. For
example
image.jpg?1234

Eliyahu

"David" <da*********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hello.

I have such problem:
I have ImageButton on my form which is attached to some image like
"image.jpg", now when I change image file (physically file) with some

other
file with the same name my page shows the old image until I click

"Refresh"
button of the browser.
So how can I refresh web form from code?
Or may be there is some other way to solve this problem?

Thank you.



Nov 19 '05 #4
Eliyahu Goldin wrote:
Yes, in the code-behind:

Response.ExpiresAbsolute = DateTime.Now.AddDays (-1);
Response.Cache.SetCacheability (System.Web.HttpCacheability.NoCache);

Response.AppendHeader ("Pragma", "no-cache");


This only affects the page itself, but not any referenced resource. In order
to make the image file non-cacheable, put all it and all other non-cacheable
images in a common folder and assign this folder the HTTP headers

Cache-Control: no-cache (*)
Pragma: no-cache

using the IIS admin applet.

(*) Technically, "Cache-Control: must-revalidate" would be the right choice,
but IE handles this incorrectly :-(
Cheers,
--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de

Nov 19 '05 #5
That is the way it should be done. I read a great article about what
yahoo.com does for their impression ads and image tracking. You will need
to put some value on the end of the src.

<img srg="http:\\site.com\images\bob.jpg?5531234">

This will force the client browser to "redownload" the image, as it doesn't
think it has it downloaded already.

bill

"David" <da*********@hotmail.com> wrote in message
news:OE**************@TK2MSFTNGP14.phx.gbl...
No! It's imposable.
Is there any other way?

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:e2****************@TK2MSFTNGP14.phx.gbl...
The image gets cached on client side. You can trick the browser onto
refreshing the image by adding a random number to the image url. For
example
image.jpg?1234

Eliyahu

"David" <da*********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hello.

I have such problem:
I have ImageButton on my form which is attached to some image like
"image.jpg", now when I change image file (physically file) with some

other
file with the same name my page shows the old image until I click

"Refresh"
button of the browser.
So how can I refresh web form from code?
Or may be there is some other way to solve this problem?

Thank you.



Nov 19 '05 #6
William F. Robertson, Jr. wrote:
That is the way it should be done.


Should? No, not really. HTTP 1.1 covers all required cache and expiration
mechanisms. But if you said "must" be done, you're most likely correct.
There are still too many crappy HTTP implementations out there that are
beyond any poor web application developer's control :-(

Cheers,
--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de
Nov 19 '05 #7

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

Similar topics

3
by: Scott | last post by:
I have a clickable graph that resides on page 1. If user clicks a data point on the graph, the page runs again yeilding a 2nd graph that shows a more detailed graph. Problem is, I have a...
1
by: Marco Maroni | last post by:
How to force image refresh on client browser ? Is ti possible to force the refresh of the same image (tha was changed server-side) to the client, without user press Contrl+F5 in IE ? - Marco
2
by: Jeronimo Bertran | last post by:
Hi, I have a page with a very data intensive grid which needs to be automatically refreshed constantly if a change is detected. In order to not refresh the complete page so often, I created an...
1
by: francois | last post by:
I have a ASPX form with a dropdownlist that makes a post back (to the same page of course, just a normal asp.net postback) That page also has an auto refresh javascript as it needs to refresh its...
9
by: PK9 | last post by:
I'm having an issue with the "Refresh" of an asp.net page. The refresh is actually calling my last onClick event. I thought that asp.net was supposed to be stateless in that it shouldn't...
0
by: Brad White | last post by:
Overview: I have a custom web app that has an 'Inbox' that refreshes every 30 seconds. One user uses Outlook to host the web page. Using IE, the refresh works fine. If the user is working in...
3
by: Kevin | last post by:
Hi guys, I want to refresh some pages every 2 seconds. however, these html pages are not in my site, they could be any pages from yahoo.com or msn.com. I can create a page, which redirect to...
8
by: Jason S | last post by:
Hi, is there any way of getting my VB (6.0) program to automatically 'Refresh' an IE window that might be active (window status not applicable). It needs to be able to determine which active IE...
10
by: phforum | last post by:
Hi, I wrote a PHP page for user input the information to search the database. And the database data will update every second. I want to set the auto refresh to get the data from database every...
5
by: =?Utf-8?B?Sm9obg==?= | last post by:
Hi, I used the following code to refresh the parent page, and it works very well (Thanks to Peter Bromberg "). Response.Write("<script language='javascript' type='text/javascript'{...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.