[Windows Phone]Problems with passing CloudFlare protection – code works in debug mode only

I wrote this function to get the cookies from the server, so that I can reuse them to get the content of the website:

public static async Task AuthorizeAniLinkz() { _cookie = "?"; var response = await http.GetAsync(new Uri("http://ift.tt/1GGX9UI;)); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(await response.Content.ReadAsStringAsync()); var challengeform = from chf in doc.DocumentNode.Descendants("form").Where(o => o.GetAttributeValue("id", null) == "challenge-form") select chf; if (challengeform.Count() > 0) { var data = from d in challengeform.First().Elements("input") select d; foreach (var input in data) if(input.GetAttributeValue("value", null) != null) _cookie += input.GetAttributeValue("name", null) + "=" + System.Net.WebUtility.UrlEncode(input.GetAttributeValue("value", null)) + "&"; var pass = await http.GetAsync(new Uri("http://ift.tt/1KRjMUf; + _cookie)); } } 

http is public static, so from what I know, it should keep all these cookies saved, but when I try to load the main page after calling and awaiting this function above in the regular, not debug mode, the server still returns an error. It just doesn't pass the verification, or maybe it does, but it doesn't store cookies.

What, why, and how is it possible? What am I doing wrong here? I'm struggling with this for a few days now and I can't fix it.

Also, it doesn't help that the protection is turned on for 2-3 hours every 2 days or so.

by MrReynevan2 via /r/csharp

Leave a Reply