回答編集履歴

1

UWPアプリ用の記述を追記

2017/12/20 13:12

投稿

umyu
umyu

スコア5846

test CHANGED
@@ -31,3 +31,33 @@
31
31
  □参考情報
32
32
 
33
33
  [ネットワークのトレースを行う](https://dobon.net/vb/dotnet/programing/networktrace.html)
34
+
35
+
36
+
37
+ ---
38
+
39
+ 2017/12/20コメント欄のやり取りを元に追記。
40
+
41
+ HttpClientのキャッシュを無効化する、UWPアプリ用のソースコード。
42
+
43
+ ```C#
44
+
45
+ using Windows.Web.Http.Filters;
46
+
47
+
48
+
49
+ HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter();
50
+
51
+ filter.CacheControl.ReadBehavior = HttpCacheReadBehavior.NoCache;
52
+
53
+ filter.CacheControl.WriteBehavior = HttpCacheWriteBehavior.Default;
54
+
55
+ HttpClient client = new HttpClient(filter);
56
+
57
+ ```
58
+
59
+ □参考情報
60
+
61
+ [HttpBaseProtocolFilter Class](https://docs.microsoft.com/en-us/uwp/api/windows.web.http.filters.httpbaseprotocolfilter)
62
+
63
+ [UWP - HttpClient in while loop only executed GET once and returns the same string as the first executed value](https://stackoverflow.com/questions/42512901/uwp-httpclient-in-while-loop-only-executed-get-once-and-returns-the-same-strin)