public static async Task <PlayerStatT> SearchPlayer(string playerName, List <int> seasons, List <int> category, string email, string password) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3; ConfigFile.IncrementTaskStarted(); string fileNameA = playerName + ".txt"; FileInfo fileName = new FileInfo(Path.Combine(ConfigFile.DIRECTORY_OUTPUT.FullName, fileNameA)); List <PlayerStatT> ThisPlayer = new List <PlayerStatT>(); foreach (int thisSeason in seasons) { int season = thisSeason - 1; string BaseAddress = "https://mwomercs.com/do/login"; var cookieContainer = new CookieContainer(); Uri uri = new Uri("https://mwomercs.com/profile/leaderboards"); var handler = new HttpClientHandler(); handler.CookieContainer = cookieContainer; handler.CookieContainer.Add(uri, new System.Net.Cookie("leaderboard_season", season.ToString())); using (var client = new HttpClient(handler) { BaseAddress = new Uri(BaseAddress) }) { client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/xml")); HttpResponseMessage risposta = await client.PostAsync(BaseAddress, new FormUrlEncodedContent( new[] { new KeyValuePair <string, string> ("email", email), new KeyValuePair <string, string> ("password", password) }) ); string responseBodyAsText = await risposta.Content.ReadAsStringAsync(); string resp = null; int lastPage = 0; foreach (int thisCategory in category) { string address = "https://mwomercs.com/profile/leaderboards?type=" + thisCategory.ToString() + "&user="******"<tr class=")) { statString = DataOps.SearchPlayerData(resp); } else if (resp.ToUpper().Contains(playerName.ToUpper())) { statString = DataOps.SearchPlayerData(resp, playerName); } PlayerStatT actualPlayerStat = DataOps.ParsePlayerStat(statString); actualPlayerStat.Season = thisSeason; actualPlayerStat.Category = thisCategory; actualPlayerStat.WebPage = -666; actualPlayerStat.WebAddress = address; ConfigFile._Global.WaitOne(); ConfigFile.GLOBAL_PLAYER.Add(actualPlayerStat); ConfigFile._Global.Release(); } } } ConfigFile.IncrementTaskFinished(); return(new PlayerStatT()); }