Sunday, March 11, 2012

DateTime value in a rendered bitmap not updating itself while inside an UpdatePanel connec

Noone knows? Maybe it's a bug? Or maybe this is not possible at all?

Hi!

Isn't it possible that you're hitting some client browser caching issue and that's why your image is not refreshed?

I suggest to take a look at the http requests with Fiddler to see what is requested and what is sent.

Thanks,

Attila


IE options->Temp. inet files Settings->Check every visit to the page.

By enabling this i can get the image to update itself every sec. But how to force the browser to update the image if the user has caching set to auto, which is the default setting in IE?

Tried setting this in the head section of my page but it doesn't work.
<meta http-equiv="pragma" content="no-cache" /
Is there any other stuff I can test? Like using theOutputCache directive.

Thanks atilla for pointing me into the right direction.

PG
Ok I managed to find some stuff on google...

"Caching can occur either on the server or at the browser. But I feel its
mostly at the browser level that causes trouble. When the browser sees that
the same URL is requested again it tries to search in its cache and if it
finds theimage it show the old one.

Set yourimageurl property to a variable string. That way everytime a unique
URL will be generated and the browser will get theimage from the server
rather than from its cache."

http://www.dotnet247.com/247reference/msgs/54/274962.aspx

http://www.dotnet247.com/247reference/msgs/50/250763.aspx

http://support.microsoft.com/default.aspx?scid=kb;EN-US;247389

And here is the magic piece of code that I added to my test app.:

protected void timer_Tick(object sender, EventArgs e)
{
imgDateTime.ImageUrl = String.Format("~/ImageGenerator.ashx?time={0}", DateTime.Now.Ticks);
}

(I'm using the default settings:IE options->Temp. inet files Settings->Automatically.)

MSDN:
DateTime.Ticks Property

Gets the number of ticks that represent the date and time of this instance.

The value of this property represents the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001.


Hope this helps if someone else has the same probs I did.

Greetings,

PG

No comments:

Post a Comment