473,671 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Strin gWriter = New
System.IO.Strin gWriter
Dim oHtmlTextWriter As System.Web.UI.H tmlTextWriter = New
System.Web.UI.H tmlTextWriter(o StringWriter)

Me.ClearControl s(imgMap)
imgMap.RenderCo ntrol(oHtmlText Writer)
Response.Write( oStringWriter.T oString())
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 12454
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.Strin gWriter = New
System.IO.Strin gWriter
Dim oHtmlTextWriter As System.Web.UI.H tmlTextWriter = New
System.Web.UI.H tmlTextWriter(o StringWriter)

Me.ClearControl s(imgMap)
imgMap.RenderCo ntrol(oHtmlText Writer)
Response.Write( oStringWriter.T oString())
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.Expire s = 0
Response.Cache. SetNoStore()
Response.Append Header("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()).getMill iseconds()"

--
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.goog legroups.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.Strin gWriter = New
System.IO.Strin gWriter
Dim oHtmlTextWriter As System.Web.UI.H tmlTextWriter = New
System.Web.UI.H tmlTextWriter(o StringWriter)

Me.ClearControl s(imgMap)
imgMap.RenderCo ntrol(oHtmlText Writer)
Response.Write( oStringWriter.T oString())
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 previewimageusi ng the following code, which
preview theimagein html page:
Dim oStringWriter As System.IO.Strin gWriter = New
System.IO.Strin gWriter
Dim oHtmlTextWriter As System.Web.UI.H tmlTextWriter = New
System.Web.UI.H tmlTextWriter(o StringWriter)
Me.ClearControl s(imgMap)
imgMap.RenderCo ntrol(oHtmlText Writer)
Response.Write( oStringWriter.T oString())
Response.End()
I've set the URL for theimageat the HTML code ofaspweb form as
follows:
<asp:Imageid="i mgMap" 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.Expire s = 0
Response.Cache. SetNoStore()
Response.Append Header("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"
<REMOVEALLCAPIT ALSeEgGoldD...@ mMvVpPsS.orgwro te:
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()).getMill iseconds()"
a minor change: ImageUrl="/mySystem/ExportImage.gif ?" +(new
Date()).getMill iseconds()"

Feb 26 '07 #5
On Feb 25, 11:31 pm, "Eliyahu Goldin"
<REMOVEALLCAPIT ALSeEgGoldD...@ mMvVpPsS.orgwro te:
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()).getMill iseconds()"

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

<nuhur...@yahoo .comwrote in message

news:11******** **************@ q2g2000cwa.goog legroups.com...
Hi..
I have a button to previewimageusi ng the following code, which
preview theimagein html page:
Dim oStringWriter As System.IO.Strin gWriter = New
System.IO.Strin gWriter
Dim oHtmlTextWriter As System.Web.UI.H tmlTextWriter = New
System.Web.UI.H tmlTextWriter(o StringWriter)
Me.ClearControl s(imgMap)
imgMap.RenderCo ntrol(oHtmlText Writer)
Response.Write( oStringWriter.T oString())
Response.End()
I've set the URL for theimageat the HTML code ofaspweb form as
follows:
<asp:Imageid="i mgMap" 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.goog legroups.com...
On Feb 25, 11:31 pm, "Eliyahu Goldin"
<REMOVEALLCAPIT ALSeEgGoldD...@ mMvVpPsS.orgwro te:
>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()).getMill iseconds()"

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

<nuhur...@yaho o.comwrote in message

news:11******* *************** @q2g2000cwa.goo glegroups.com.. .
Hi..
I have a button to previewimageusi ng the following code, which
preview theimagein html page:
Dim oStringWriter As System.IO.Strin gWriter = New
System.IO.Strin gWriter
Dim oHtmlTextWriter As System.Web.UI.H tmlTextWriter = New
System.Web.UI.H tmlTextWriter(o StringWriter)
Me.ClearControl s(imgMap)
imgMap.RenderCo ntrol(oHtmlText Writer)
Response.Write( oStringWriter.T oString())
Response.End()
I've set the URL for theimageat the HTML code ofaspweb form as
follows:
<asp:Imageid="i mgMap" 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.Strin gWriter = New
System.IO.Stri ngWriter
Dim oHtmlTextWriter As System.Web.UI.H tmlTextWriter = New
System.Web.UI. HtmlTextWriter( oStringWriter)
Me.ClearContro ls(imgMap)
imgMap.RenderC ontrol(oHtmlTex tWriter)
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
automaticall y 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.Expire s = 0
Response.Cache. SetNoStore()
Response.Append Header("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********@joer gjooss.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.Strin gWriter = New
System.IO.Strin gWriter
Dim oHtmlTextWriter As System.Web.UI.H tmlTextWriter = New
System.Web.UI.H tmlTextWriter(o StringWriter)
Me.ClearControl s(imgMap)
imgMap.RenderCo ntrol(oHtmlText Writer)
Response.Write( oStringWriter.T oString())
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 programmaticall y, use System.IO.File. SetLastWriteTim e().

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


Hi..
I have a button to previewimageusi ng the following code, which
preview theimagein html page:
Dim oStringWriter As System.IO.Strin gWriter = New
System.IO.Strin gWriter
Dim oHtmlTextWriter As System.Web.UI.H tmlTextWriter = New
System.Web.UI.H tmlTextWriter(o StringWriter)
Me.ClearControl s(imgMap)
imgMap.RenderCo ntrol(oHtmlText Writer)
Response.Write( oStringWriter.T oString())
Response.End()
I've set the URL for theimageat the HTML code of asp web form as
follows:
<asp:Imageid="i mgMap" 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 programmaticall y, use System.IO.File. SetLastWriteTim e().

Cheers,
--
Joerg Jooss
news-re...@joergjoos s.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

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

Similar topics

9
4916
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 == "") { include ("InsertRecord.inc"); // Insert new record }
1
8373
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. The image was ftp'ed to ftp://mydomain.org/webcam.jpg. On my website was a file, webcam.htm, that had a place for the image, webcam.jpg. I put an HTML code on my webcam page that caused it to refresh every 3 minutes -- every 3 minutes, the...
6
8783
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 clicks a cmd button to open the Windows API Common Dialog and selects a new file (jpeg). Images are initially loaded in the form's oncurrent event. I've tried using me.dirty = false to make the form current. Has anyone experienced this before?
1
10853
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
2719
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 problem is that this page shows the client Logo image, then asks to upload a new one if required, finally it should show the uploaded picture. The problem is that it doesn't. If I press F5, then I can see the updated
1
1916
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) so after the change the datagrid does'nt refresh the image because her name did not change. My question is : Is there a way to "refresh" the datagrid after the edit function, to refresh the image ?
17
8515
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 Invalidate and an Update. Can someone shed some light?
10
23410
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? Thanks very much for your help! Fred
11
5661
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 didn't help. The problem is that this page does not change images after a client uploads a new one. If I hit the browser's refresh, then I can see the updated image, but if I don't refresh, then I see the previous image.
5
8620
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 refresh, even after putting a "refresh", or "repaint" or "requery" statement in the afterupdate event. The only way to make it update is to move to the next record and then move back again. Private Sub Stock_ImageLocation_AfterUpdate()
0
8926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8824
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8603
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8673
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7444
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6236
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5703
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2818
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.