在WP7应用程序的Web客户端请求缓存问题 [英] web client request caching issue in wp7 app
问题描述
我创建了一个 JSON网络服务
&安培;在我的网站上使用。结果
现在我想用它在我的Windows Phone应用程序来显示数据,这是由网络服务接收。让我心中已经写下面的代码--->
i'd created a json web service
& used in my web site.
Now i want use it in my windows phone app to show the data, which is receiving by that web service. So that i'v written the code below--->
//// some code
StartThread();
}
void StartThread()
{
DispatcherTimer TradeThread = new DispatcherTimer();
TradeThread.Interval = TimeSpan.FromMilliseconds(1000);
TradeThread.Tick += new EventHandler(BindData);
TradeThread.Start();
}
void BindData(object sender, EventArgs e)
{
WebClient wc = new WebClient();
wc.DownloadStringAsync(new Uri("some URL"));
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
}
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
JObject jsonObject = JObject.Parse(e.Result);
///// some code
中的代码工作正常,但是,一些请求后的数据没有更新。因此,我认为有一些问题缓存&安培;我不知道如何禁用缓存或以获取更新的每个requets 数据bcoz我心中已经从不使用Web客户端befor任何替代方法。
The code is working fine, But after some requests the data is not updating. So i think there is some caching problem & i dont know how to disable caching or any alternative way to get updated data on each requets bcoz i'v never used web client befor.
所以,如果有人使用了比PLZ Web服务检查上面&放我的代码;做评论或编辑,如果有这个缓存问题...........感谢名单
So if anyone have used the web services than plz check my code above & do comment or edit it if have any solution for this caching problem ...........thanx
推荐答案
任何解决方案一个简单的解决方法是追加,在查询字符串的结尾上操作搜索请求变化的值:disablecache =
An easy workaround is to append a value that changes on earch request at the end of the query string:
"?disablecache=" + Environment.TickCount
这篇关于在WP7应用程序的Web客户端请求缓存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!