WP7 - RestSharp Caching Prevention

I am using RestSharp in my Windows Phone 7.1 project.

My problem is that RestSharp always stores cache data.

Example:

The first time I submit a request, it correctly returns the data. After some delete operations, I will send this request again, but the answer seems the same as the first time, nothing has changed.

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

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

How can I fix this problem?

+3
source share
4 answers

I found a solution in the comment of Rico Suter, thanks! I will mark this as accepted by anwser

, - url = originalUrl + "& nocache =" + DateTime.Now.Ticks

+3

, , , - RestClient url, Cache-Control no-cache.

client.AddDefaultHeader("Cache-Control", "no-cache")
+3

"Cache-Control" !

, HTTP , , , ! Cache-Control Cache-Control...

, Pragma no-cache ( "Cache-Control", )!

Fiddler , , !

+1

Another solution would be to set the “If-Modified-Since” header with the value DateTime.Now:

client.AddDefaultParameter("If-Modified-Since", DateTime.Now, ParameterType.HttpHeader);
0
source

All Articles