在通常的.NET环境中,我们在类HttpWebRequest中有一个属性AutomaticDecompression。
httpRequest.AutomaticDecompression =
(DecompressionMethods.GZip | DecompressionMethods.Deflate);
问题是我在WinRT上,而且HttpWebRequest类中没有这样的属性。我有什么?我有GZip压缩的响应流......
答案 0 :(得分:1)
使用HttpClientHandler,因为它支持AutomaticDecompression:
System.Net.Http.HttpClientHandler hc = new System.Net.Http.HttpClientHandler();
hc.AutomaticDecompression = System.Net.DecompressionMethods.GZip;
System.Net.Http.HttpClient client = new System.Net.Http.HttpClient(hc);
var result = await client.GetAsync(uri)