I have a problem with HttpClient (System.Net.Http.HttpClient).
I send a POST to a website to connect to my personnal space:
On Windows 8.1 : it works great, I am conencted (Response : HTTP OK)
On Windows Phone 8.1 : the connection does'nt work (Response : HTTP FOUND and not HTTP OK)
What is the diffrence between the two platforms ?
I use the following code :
System.Net.Http.HttpResponseMessage msg1 = await this._client.GetAsync(new Uri(UrlLogin));
HtmlDocument document1 = new HtmlDocument();
document1.LoadHtml(await msg1.Content.ReadAsStringAsync());
List<KeyValuePair<String, String>> hiddenInputNodes1 = document1.DocumentNode.Descendants().Where(x => x.GetAttributeValue("type") == "hidden" && x.Name == "input").Select(x => new KeyValuePair<String, String>(x.GetAttributeValue("name"), x.GetAttributeValue("value"))).ToList();
List<KeyValuePair<String, String>> list1 = new List<KeyValuePair<string, string>>();
list1.Add(new KeyValuePair<String, String>("username", username));
list1.Add(new KeyValuePair<String, String>("password", password));
list1.AddRange(hiddenInputNodes1);
System.Net.Http.HttpResponseMessage msg2 = await this._client.PostAsync(new Uri(UrlConnection), new FormUrlEncodedContent(list1));
return (msg2.RequestMessage.RequestUri.ToString() == UrlAccount);
Edit : I don't use Windows.Web.Http.HttpClient because when I use it I have an Hresult on a specific website (it works on other websites) I found the problem, HttpClient doesn't support automatic redirection whereas it is supported on Windows 8.1