Windows Phone 7中的HttpWebRequest缓存 [英] Httpwebrequest caching in windows phone 7

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

问题描述

在使用wp7开发应用程序时,缓存存在问题.1和httpwebrequest方法.

I have an issue with caching while developing an app using wp7. 1 and the httpwebrequest method.

HttpWebRequest request = HttpWebRequest. CreateHttp (s);
request. BeginGetResponse (new AsyncCallback (HandleResponse), request);

即使请求内容不同,请求的结果也相同.并在请求中有不同参数的情况下.我该如何解决这个问题?

The result of the request is the same even in case of a different request content. And in the case of different parameters in the request. How can i fix this issue?

谢谢.

推荐答案

这可能对您有所帮助.试试

May this helps you. try it

 HttpWebRequest request = HttpWebRequest. CreateHttp (s);
    request.Headers[HttpRequestHeader.CacheControl] = "no-cache"; 
    request.Headers[HttpRequestHeader.Pragma] = "no-cache"; 
    request.Headers[HttpRequestHeader.IfModifiedSince] = dateTime.Now.ToString();
    request. BeginGetResponse (new AsyncCallback (HandleResponse), request);

/*request.Headers[HttpRequestHeader.IfModifiedSince] = dateTime.Now.ToString(); this forces your request to always be performed - this made the trick for me.*/

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

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