Forcing a “fromUrl” to read a file in Genexus 16U11

Solution for Forcing a “fromUrl” to read a file in Genexus 16U11
is Given Below:

I’m working with Genexus 16U11 in C#: I have a web panel with an image variable, when I click a button it should load in the variable an image from a specific URL, so in the event I have

Event 'Dodestra'

     &SpeseFoto.FromURL(&targetPath)

EndEvent

Where targetpath is set previously.

It works the first time, but if I change the image in the url, it continues to load always the same image, I need to delete the cache to make it works. As in this program the image in the url has to change very often, this is a problem.

How can I force a reload of the image with the fromURL method?

EDIT: this in Chrome. In Edge and Firefox it correctly sees the new image. I tried to add this Form.Meta.AddItem(“pragma”,”no-cache”) but without success

I found a workaround: I can add a random parm to the url, in this way chrome is forced to check again the url&randomn = Random()

&randomn = Random()
&randomx = &randomN * 10000000000
&nomeRandom = &targetPath+"?random="+&randomx.ToString().Trim()
&SpeseFoto.FromURL(&nomeRandom)

Not a lot elegant, but it works