I have created a desktop application which continuously changes the image on a fixed path and fixed filename 00.jpg. The image is in the path of my web site folder. The image is viewed on browser by . But the image is not changing continuously on the browser.
I tried using both client (javascript) and server (asp.net) timers but It does not result.
Here is my ASP.net AJAX Timer code and markup:
<form id="form1" runat="server">
<div>
<asp:ScriptManager runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="up1" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:Image ImageUrl="00.jpg" ID="img1" runat="server" />
<asp:Timer ID="Timer1" runat="server" Interval="100" ontick="Timer1_Tick"></asp:Timer>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
</div>
</form>
protected void Timer1_Tick(object sender, EventArgs e)
{
string xx = Request.Url.AbsoluteUri;
xx = xx.Replace ("Default.aspx","00.jpg");
img1.ImageUrl = xx; up1.Update();
}
I’m suspecting a cache issue on the image. Maybe try to either disable the cache on this image, or build unique url with :
But actually, you should consider using a pure javascript (with jQuery or similar if you want) solution. This will avoid a server round trip.
This post explain exactly your need with a solution.