0

I'm using Hammock in a Windows Phone app to request data from a REST service. I have a photo album page that shows a list of thumbnails. On this page, I have a button to upload a photo to the service. After a success response is received I'm calling my GetPhotos method again to refresh the thumbnail view. However every time I call this in a current session, I always get back the original number of photos. I can load a different album on the page and then reload this album and the new photo is still not included in the rest response. I can go to the site and see the photo was uploaded, but I can't get it to return in the api unless I restart my app.

(I also have a request in with the service to see if there is caching on their end)

Any clue if there is caching going on here on the hammock or even windows phone side?

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
earthling
  • 5,084
  • 9
  • 46
  • 90
  • Related question: http://stackoverflow.com/questions/6334788/windows-phone-7-webrequest-caching/ – bbaia Mar 13 '12 at 07:14

1 Answers1

1

On the server side, make sure you are setting the Caching to NoCache. Your mileage may vary depending on what you're using to implement your REST service, but something along the lines of:

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Robaticus
  • 22,857
  • 5
  • 54
  • 63
  • So that sounds like something I don't have control over. I do have a request in to see if that is happening on the server side. thanks! – earthling Mar 12 '12 at 17:51
  • 1
    If you are crafting your own URL, you may also be able to overcome this by passing in a dummy parameter. See my answer here: http://stackoverflow.com/questions/9668884/webclient-in-a-wp7-1-app-called-only-once – Robaticus Mar 12 '12 at 17:54