I have created simple .aspx page which queries a database for some live data and then returns a JSONP (or at last a JSONP-like) feed of Content-Type application/json; charset=utf-8
Here is the format of the output, more or less:
jsonp1307643489579([
["12345","Text Here","99999","More Text Here","True","False","7/31","1"...],
["12345","Text Here","99999","More Text There",...]
]
Then comes a JQuery .getJSON call:
var url = "myURL.aspx?id=123&callBack=?";
$.getJSON(url, null, function(msg) { etc etc.
It all works fine except for the following. In my development environment and on my local server, fresh data come back live every time. But on the production web server, the data stubbornly caches until I recycle the IIS application pool (!)
Some things I have tried without success.
1/ cache: false in ajaxSetup didn’t work.
2/ Turned off output caching in the web.config.
2a/ OutputCache Location=”None” in the aspx page declarations doesn’t do it.
3/ Added random unique querystring data to the .getJSON(url) call. Seeing as how we are appending a unique callback param to each call, I guess this was already happening anyway.
Any idea why my web server is holding on to these cached application/JSON files?
EDIT: i am viewing the actual .aspx feeds as they come down from the web server, and they are cached there. So to my understanding, it’s a web server caching issue and not necessarily a JQUERY caching issue.
It turned out that it was indeed the .ASPX server page caching the data. For all of the focus on the client-side AJAX stuff, I overlooked the obvious.
So I added a litany of preventative measures on the server side (Response.ExpiresAbsolute, et cetera) and it did the job.