本記事では、WindowsストアアプリでHttpClientを使ってReferrer等のリクエストヘッダを指定してインターネット上のリソースへアクセスする方法を紹介します。 以前、「MetroスタイルアプリでHttpWebRequestを使って画像をダウンロードさせる方法」をご紹介しました。 しかし、とあるウェブサイトの画像を取得する為には、Refererに特定のアドレスを設定する必要があったのですが、HttpWebRequestクラスにはRefererプロパティが存在せずHeadersプロパティ経由でRefererを変更する事ができませんでした。以下のコードの様な設定の仕方では、7/24時点のRelease Previewでは例外が吐かれてしまいます。 |cs| HttpWebRequest req = GetRequest(); req.Headers[HttpRequestHeade