If you are using Windows.Web.Http.HttpClient
, you can skip the local cache this way:
Windows.Web.Http.Filters.HttpBaseProtocolFilter filter =
new Windows.Web.Http.Filters.HttpBaseProtocolFilter();
filter.CacheControl.ReadBehavior =
Windows.Web.Http.Filters.HttpCacheReadBehavior.MostRecent;
HttpClient client = new HttpClient(filter);
Uri uri = new Uri("http://example.com");
HttpResponseMessage response = await client.GetAsync(uri);
response.EnsureSuccessStatusCode();
string str = await response.Content.ReadAsStringAsync();
You will never get the same response twice again :)
But if you have access to the server source code, the most elegant fix would be to disable the cache for the URI you are downloading, i.e., add the Cache-Control: no-cache
header.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…