如何禁用WebClient和Windows Phone 7的缓存 [英] How do you disable caching with WebClient and Windows Phone 7

查看:83
本文介绍了如何禁用WebClient和Windows Phone 7的缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调用REST Web服务,并且该移动应用正在从其缓存中检索结果,而不是去服务器。

I am making a call to a REST web service and the mobile app is retrieving the results from its cache and not going to the server.

我看到了其他建议的修复方法(类似问题类似问题2 ),但Cache属性在Silverlight 4中不可用。

I have seen other suggested fixes (similar issue and similar issue2) but the Cache property is not available in silverlight 4.

是否有人知道如何强制Windows Phone 7上的Silverlight 4发出请求而不访问缓存?

Does anyone have an idea of how to force silverlight 4 on windows phone 7 to make a request and not hit the cache?

推荐答案

虽然不理想,但一种简单的解决方案是发送诸如垃圾字段之类的值 DateTime.Now 。这样,价值永远是全新的,永远不会被缓存。例如,如果您在标准查询中这样做:

Although not ideal, a easy solution is to send something like the field "junk" with the value DateTime.Now. That way, a value is always brand new, and will never get cached. If you were doing this in a standard querysting for example:

"&junk=" + DateTime.Now;

这篇关于如何禁用WebClient和Windows Phone 7的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆