views:

18

answers:

1

Hi Guys

I am having the following problem:

I have a WCF service that checks a database table and returns the results vis JSON to a flash app.
The flash app polls the WCF service every 2 seconds until the records are ready. The issue is that flash seems to be caching my requests, as after the first request the service never gets hit again!
I have found a workaround, by appending a random number onto the query string but there has to be a better way around this than that??

any input is greatly appreciated.

Cheers

+1  A: 

Appending a random string is the most commonly used way to get around the cache.

You can try setting pragma: no-cache header, but I am not sure this will be honored; I have a faint memory of this not working for me in the past - please see it for yourself and post back :-)

var header:URLRequestHeader = new URLRequestHeader("pragma", "no-cache");
var request:URLRequest = new URLRequest(url);
request.requestHeaders.push(header);

If you have control over the web service, you can send pragma: no-cache header, which I assume you'd be doing already.

Amarghosh
back2dos
Thanks a mill, setting the header in flash didnt work, but setting the header in the WCF service did! heres the link so see how to set the headers: http://www.robbagby.com/rest/rest-in-wcf-part-x-supporting-caching-and-conditional-get/
kyle