WP7 - 防止 RestSharp 缓存 [英] WP7 - Prevent RestSharp from caching
问题描述
我在 Windows Phone 7.1 项目中使用 RestSharp.
I use RestSharp in my Windows Phone 7.1 project.
我的问题是 RestSharp 总是缓存响应数据.
My problem is RestSharp always cache response data.
示例:
我第一次发送请求时,它正确返回数据.一些删除操作后,我再次发送该请求,但响应似乎与第一次相同,没有任何变化.
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.
如果我停止调试并按 F5 重新启动,它会按预期完美运行.
If I stop debugging and press F5 to start again, it works perfectly as expected.
我也试过 request.AddParameter("cache-control", "no-cache", ParameterType.HttpHeader);
但没有成功.
I also tried request.AddParameter("cache-control", "no-cache", ParameterType.HttpHeader);
and got no luck.
我该如何解决这个问题?
How can I fix this problem?
推荐答案
我在 Rico Suter 的评论中找到了解决方案,谢谢!我会将其标记为已接受的回答
I found solution in Rico Suter comment, thanks! I will mark this as accepted anwser
这是一个黑客,但尝试类似 url = originalUrl + "&nocache=" + DateTime.Now.Ticks
its a hack but try something like url = originalUrl + "&nocache=" + DateTime.Now.Ticks
这篇关于WP7 - 防止 RestSharp 缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!