473,395 Members | 1,666 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,395 software developers and data experts.

Refresh image

Hi..

I have a button to preview image using the following code, which
preview the image in html page:

Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)

Me.ClearControls(imgMap)
imgMap.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()

I've set the URL for the image at the HTML code of asp web form as
follows:

<asp:Image id="imgMap" runat="server" Height="481px" Width="587px"
ImageUrl="/mySystem/ExportImage.gif"></asp:Image>

The image resides at the server and always be changed based on users'
selection. The first try of clicking the preview button, it works
successfully. However, when the image has been changed, clicking at
the button again will not preview the latest image. It gives the same
image as previously. But, I will only get the latest image when I
click on the IE refresh button. How could I get the latest image
automatically without pressing at the IE refresh button? Anyone can
help me to solve this...?

Thanks for any help..

Feb 26 '07 #1
11 12429
On Feb 26, 7:52 am, nuhur...@yahoo.com wrote:
Hi..

I have a button to preview image using the following code, which
preview the image in html page:

Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)

Me.ClearControls(imgMap)
imgMap.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()

I've set the URL for the image at the HTML code of asp web form as
follows:

<asp:Image id="imgMap" runat="server" Height="481px" Width="587px"
ImageUrl="/mySystem/ExportImage.gif"></asp:Image>

The image resides at the server and always be changed based on users'
selection. The first try of clicking the preview button, it works
successfully. However, when the image has been changed, clicking at
the button again will not preview the latest image. It gives the same
image as previously. But, I will only get the latest image when I
click on the IE refresh button. How could I get the latest image
automatically without pressing at the IE refresh button? Anyone can
help me to solve this...?

Thanks for any help..
you can try to add in your Page_Load

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

and see if it helps

Feb 26 '07 #2
The image is cached on client side. You can trick the browser into
re-loading it from the server by adding a random query parameter to the
image url:

ImageUrl="/mySystem/ExportImage.gif +(new Date()).getMilliseconds()"

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<nu******@yahoo.comwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
Hi..

I have a button to preview image using the following code, which
preview the image in html page:

Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)

Me.ClearControls(imgMap)
imgMap.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()

I've set the URL for the image at the HTML code of asp web form as
follows:

<asp:Image id="imgMap" runat="server" Height="481px" Width="587px"
ImageUrl="/mySystem/ExportImage.gif"></asp:Image>

The image resides at the server and always be changed based on users'
selection. The first try of clicking the preview button, it works
successfully. However, when the image has been changed, clicking at
the button again will not preview the latest image. It gives the same
image as previously. But, I will only get the latest image when I
click on the IE refresh button. How could I get the latest image
automatically without pressing at the IE refresh button? Anyone can
help me to solve this...?

Thanks for any help..

Feb 26 '07 #3
On Feb 25, 11:11 pm, "Alexey Smirnov" <alexey.smir...@gmail.com>
wrote:
On Feb 26, 7:52 am, nuhur...@yahoo.com wrote:


Hi..
I have a button to previewimageusing the following code, which
preview theimagein html page:
Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)
Me.ClearControls(imgMap)
imgMap.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()
I've set the URL for theimageat the HTML code ofaspweb form as
follows:
<asp:Imageid="imgMap" runat="server" Height="481px" Width="587px"
ImageUrl="/mySystem/ExportImage.gif"></asp:Image>
Theimageresides at the server and always be changed based on users'
selection. The first try of clicking the preview button, it works
successfully. However, when theimagehas been changed, clicking at
the button again will not preview the latestimage. It gives the same
imageas previously. But, I will only get the latestimagewhen I
click on the IErefreshbutton. How could I get the latestimage
automatically without pressing at the IErefreshbutton? Anyone can
help me to solve this...?
Thanks for any help..

you can try to add in your Page_Load

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

and see if it helps- Hide quoted text -

- Show quoted text -
Alexey,

I've tried your code, but it still doesn't work --it picks-up the
previous image. Any idea??

Feb 26 '07 #4
On Feb 26, 8:31 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
The image is cached on client side. You can trick the browser into
re-loading it from the server by adding a random query parameter to the
image url:

ImageUrl="/mySystem/ExportImage.gif +(new Date()).getMilliseconds()"
a minor change: ImageUrl="/mySystem/ExportImage.gif?" +(new
Date()).getMilliseconds()"

Feb 26 '07 #5
On Feb 25, 11:31 pm, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
Theimageis cached on client side. You can trick the browser into
re-loading it from the server by adding a random query parameter to theimageurl:

ImageUrl="/mySystem/ExportImage.gif +(new Date()).getMilliseconds()"

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net

<nuhur...@yahoo.comwrote in message

news:11**********************@q2g2000cwa.googlegro ups.com...
Hi..
I have a button to previewimageusing the following code, which
preview theimagein html page:
Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)
Me.ClearControls(imgMap)
imgMap.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()
I've set the URL for theimageat the HTML code ofaspweb form as
follows:
<asp:Imageid="imgMap" runat="server" Height="481px" Width="587px"
ImageUrl="/mySystem/ExportImage.gif"></asp:Image>
Theimageresides at the server and always be changed based on users'
selection. The first try of clicking the preview button, it works
successfully. However, when theimagehas been changed, clicking at
the button again will not preview the latestimage. It gives the same
imageas previously. But, I will only get the latestimagewhen I
click on the IErefreshbutton. How could I get the latestimage
automatically without pressing at the IErefreshbutton? Anyone can
help me to solve this...?
Thanks for any help..- Hide quoted text -

- Show quoted text -
Hi Eliyahu,

I've tried to add a random query parameter to the image url as you
have suggested. But it makes the preview page doesn't show the image
at all... Any idea to solve this???

Thanks in advance for your help.
Feb 26 '07 #6
Just use Alexey's correction, I didn't have time to look in my typing when I
posted the first answer.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<nu******@yahoo.comwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
On Feb 25, 11:31 pm, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
>Theimageis cached on client side. You can trick the browser into
re-loading it from the server by adding a random query parameter to
theimageurl:

ImageUrl="/mySystem/ExportImage.gif +(new Date()).getMilliseconds()"

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP
[ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net

<nuhur...@yahoo.comwrote in message

news:11**********************@q2g2000cwa.googlegr oups.com...
Hi..
I have a button to previewimageusing the following code, which
preview theimagein html page:
Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)
Me.ClearControls(imgMap)
imgMap.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()
I've set the URL for theimageat the HTML code ofaspweb form as
follows:
<asp:Imageid="imgMap" runat="server" Height="481px" Width="587px"
ImageUrl="/mySystem/ExportImage.gif"></asp:Image>
Theimageresides at the server and always be changed based on users'
selection. The first try of clicking the preview button, it works
successfully. However, when theimagehas been changed, clicking at
the button again will not preview the latestimage. It gives the same
imageas previously. But, I will only get the latestimagewhen I
click on the IErefreshbutton. How could I get the latestimage
automatically without pressing at the IErefreshbutton? Anyone can
help me to solve this...?
Thanks for any help..- Hide quoted text -

- Show quoted text -

Hi Eliyahu,

I've tried to add a random query parameter to the image url as you
have suggested. But it makes the preview page doesn't show the image
at all... Any idea to solve this???

Thanks in advance for your help.


Feb 26 '07 #7
Thus wrote Alexey,
On Feb 26, 7:52 am, nuhur...@yahoo.com wrote:
>Hi..

I have a button to preview image using the following code, which
preview the image in html page:

Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)
Me.ClearControls(imgMap)
imgMap.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()
I've set the URL for the image at the HTML code of asp web form as
follows:

<asp:Image id="imgMap" runat="server" Height="481px" Width="587px"
ImageUrl="/mySystem/ExportImage.gif"></asp:Image>

The image resides at the server and always be changed based on users'
selection. The first try of clicking the preview button, it works
successfully. However, when the image has been changed, clicking at
the button again will not preview the latest image. It gives the same
image as previously. But, I will only get the latest image when I
click on the IE refresh button. How could I get the latest image
automatically without pressing at the IE refresh button? Anyone can
help me to solve this...?

Thanks for any help..
you can try to add in your Page_Load

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
and see if it helps
Making the page non-cacheable won't help. The images are static content and
are served by IIS.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Feb 26 '07 #8
Thus wrote nu******@yahoo.com,
Hi..

I have a button to preview image using the following code, which
preview the image in html page:

Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)
Me.ClearControls(imgMap)
imgMap.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()
I've set the URL for the image at the HTML code of asp web form as
follows:

<asp:Image id="imgMap" runat="server" Height="481px" Width="587px"
ImageUrl="/mySystem/ExportImage.gif"></asp:Image>

The image resides at the server and always be changed based on users'
selection. The first try of clicking the preview button, it works
successfully. However, when the image has been changed, clicking at
the button again will not preview the latest image. It gives the same
image as previously. But, I will only get the latest image when I
click on the IE refresh button. How could I get the latest image
automatically without pressing at the IE refresh button? Anyone can
help me to solve this...?
See http://www.joergjooss.de/PermaLink,g...406ad4bdf.aspx

In order to "touch" the file programmatically, use System.IO.File.SetLastWriteTime().

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Feb 26 '07 #9
On Feb 26, 1:36 pm, Joerg Jooss <news-re...@joergjooss.dewrote:
Thus wrote nuhur...@yahoo.com,


Hi..
I have a button to previewimageusing the following code, which
preview theimagein html page:
Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)
Me.ClearControls(imgMap)
imgMap.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()
I've set the URL for theimageat the HTML code of asp web form as
follows:
<asp:Imageid="imgMap" runat="server" Height="481px" Width="587px"
ImageUrl="/mySystem/ExportImage.gif"></asp:Image>
Theimageresides at the server and always be changed based on users'
selection. The first try of clicking the preview button, it works
successfully. However, when theimagehas been changed, clicking at
the button again will not preview the latestimage. It gives the same
imageas previously. But, I will only get the latestimagewhen I
click on the IErefreshbutton. How could I get the latestimage
automatically without pressing at the IErefreshbutton? Anyone can
help me to solve this...?

Seehttp://www.joergjooss.de/PermaLink,guid,2316ed51-f87c-4249-924c-99d40...

In order to "touch" the file programmatically, use System.IO.File.SetLastWriteTime().

Cheers,
--
Joerg Jooss
news-re...@joergjooss.de- Hide quoted text -

- Show quoted text -
Thanks Joerg, I've read your article and try it, it works!! The latest
image is showed. But why the browser doesn't automatically resubmit
the information of the system back to me when I click on the IE "Back/
Previous" button? Meaning that I've to click on the Refresh button in
order to get the information.

Another thing that I'm confusing is about the setting for the Custom
HTTP Header Name and Value. What is the purpose of the Custom Header
Value and is the there any standards that I've to follow or I can put
anything?

Thanks a lot for your help...

Feb 27 '07 #10
On Feb 27, 2:28 am, nuhur...@yahoo.com wrote:
Thanks Joerg, I've read your article and try it, it works!! The latest
image is showed. But why the browser doesn't automatically resubmit
the information of the system back to me when I click on the IE "Back/
Previous" button? Meaning that I've to click on the Refresh button in
order to get the information.
because it use the cache

http://support.microsoft.com/kb/234067

Feb 27 '07 #11
On Feb 27, 10:19 am, "Alexey Smirnov" <alexey.smir...@gmail.com>
wrote:

because it used the cache
Feb 27 '07 #12

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

Similar topics

9
by: Mark | last post by:
I have a working PHP/MySQL application used for data entry. The data entry screen includes a "Save" button. The PHP code for this button looks like this: if (isset($_POST)) { if ($_POST ==...
1
by: SPQR | last post by:
Some time ago I set up a webcam at home and a page on my site. Every three minutes the webcam would take a picture of my backyard and ftp it to my site where it was displayed on my webcam page. ...
6
by: Arnold | last post by:
Hey there, I've browsed for some fixes to this but only found a couple of similar posts, which didn't solve my problem. I'm wondering how to refresh an image control in a form after a user...
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: Just D. | last post by:
All, How should we refresh the current aspx frame? I disabled caching using this command on Page_Load(): Response.Cache.SetCacheability(HttpCacheability.NoCache); but it didn't help. The...
1
by: Andre | last post by:
hi, In my Datagrid i have some text and a image (for each item), if i edit the image and save it to the HD there's no problem, but the image is always saved with the same name (item number.jpg)...
17
by: SamSpade | last post by:
picDocument is a picturebox When I do picDocument.Invalidate() the box paints. But if instead I do picDocument.Refresh() the box does not paint. What does Refresh do. I guessed it did an...
10
by: Fred Nelson | last post by:
Hi: I have a VB.NET web application and I need to find a way to cause a page refresh from within my application. Does anyone know how to force the browser to refresh the current page? ...
11
by: Jerry J | last post by:
How can I get an asp:Image to refresh when a user uploads a different jpg. I disabled caching using this command on Page_Load(): Response.Cache.SetCacheability(HttpCacheability.No Cache); but it...
5
by: mattcolenutt | last post by:
Scenario: Have a product form with an "image location" field. The image property uses this field to display the image. Problem: If an image location field has been changed, the image will not...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.