Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WP7 - Prevent RestSharp from caching

I use RestSharp in my Windows Phone 7.1 project.

My problem is RestSharp always cache response data.

Example:

At the first time I send request, it returns data correctly. After some delete operations, I send that request again, but response seems the same as the first time, nothing's changed.

If I stop debugging and press F5 to start again, it works perfectly as expected.

I also tried request.AddParameter("cache-control", "no-cache", ParameterType.HttpHeader); and got no luck.

How can I fix this problem?

like image 884
Mia Avatar asked Feb 20 '23 18:02

Mia


1 Answers

I have the same issue so just add header that specify not to cache response data client is my RestClient with base url and than add default header Cache-Control with value no-cache.

client.AddDefaultHeader("Cache-Control", "no-cache")
like image 153
Aseem Aggawral Avatar answered Mar 12 '23 20:03

Aseem Aggawral