public async System.Threading.Tasks.Task LoadAsync() { string url = _site.getGalleryUrl(_collection.idCode, _page, _collection.pictures); using (HttpClient hc = new HttpClient()) { string html = null; try { HttpRequestMessage httpRequest = new HttpRequestMessage(HttpMethod.Get, new Uri(url)); httpRequest.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36"); HttpResponseMessage responseAsync = await hc.SendRequestAsync(httpRequest); responseAsync.EnsureSuccessStatusCode(); IBuffer asyncBuffer = await responseAsync.Content.ReadAsBufferAsync(); byte[] resultByteArray = asyncBuffer.ToArray(); EncodingProvider provider = CodePagesEncodingProvider.Instance; Encoding.RegisterProvider(provider); html = Encoding.GetEncoding("UTF-8").GetString(resultByteArray, 0, resultByteArray.Length); } catch (Exception e) { new MessageDialog(e.StackTrace, e.Message).ShowAsync(); } if (!string.IsNullOrEmpty(html)) { _myCollection = RuleParser.GetCollectionDetail(_collection, html, _site.galleryRule, url); this.galleryView.ItemsSource = _myCollection.pictures; } } }