I am coding a PCL Web Lib calling for Windows Phone 8.1 RT and Windows 8.1 app
While HttpWebRequest Class can NOT modify HOST, referer and so on headers running is Windows RT 8.1 app (WP8.1 RT runs OK, it is a bug in Microsoft)
So I want to use HttpClient Class. One UnResolve issue is how to modify request HOST? I can set different HOST without any exception. But actually, the request HOST is not applied. below is my code:
var client = new HttpClient();
var request = new HttpRequestMessage()
{
RequestUri = new Uri("http://www.bing.com"),
Method = HttpMethod.Get,
};
client.DefaultRequestHeaders.Host = new HostName("12.34.56.78");
//client.DefaultRequestHeaders.Add("Host", "12.34.56.78");
var respose = await client.SendRequestAsync(request);
var content = await respose.Content.ReadAsStringAsync();