WP7 HttpWebRequest without caching

前端 未结 7 2146
北荒
北荒 2020-12-01 09:53

It seems that HttpWebRequest caching in WP7 is enabled by default, how do I turn it off? Adding a random param url + \"?param=\" + RND.Next(10000) works, but it\'s quite

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-01 10:16

    In case of HttpClient (Portable for Windows Phone) "Cache-Control": "no-cache" on server side works only sometimes. And I cannot add query string random value to RESTful api call as well.

    Solution from @frno works good and looks like for HttpClient:

    client.DefaultRequestHeaders.IfModifiedSince = DateTime.UtcNow;
    

    Thank you.

提交回复
热议问题