title: Task overrides task
body: <p>I have a task to fetch content from my server. The problem is, that sometimes a Task overrides the task before, so I get two times the same result.</p>
  
  <p>My Code:</p>
  
  <pre><code> Task&lt;string&gt; task = Server.GetText();
          string result = await task;
          if (result == "\n")
          {
              .....
          }
          else
          {
              string[] sarray = result.Split('|');
  
              App.MainList.Add(new etc.Text(sarray[0], sarray[1], sarray[2], sarray[3], sarray[4]));
  
              App.Number++;
          }
  </code></pre>
  
  <p>GetText():</p>
  
  <pre><code>public static async Task&lt;string&gt; GetText()
      {
          if (App.Number &lt;= App.Total)
          {
              HttpClient http = new System.Net.Http.HttpClient();
              HttpResponseMessage response = await http.GetAsync(queryuri + "?w=" + App.Number.ToString());
              return await response.Content.ReadAsStringAsync();
          }
  
          else
          {
              App.Number = 1;
              HttpClient http = new System.Net.Http.HttpClient();
              HttpResponseMessage response = await http.GetAsync(queryuri + "?w=" + App.Number.ToString());
              return await response.Content.ReadAsStringAsync();
          }
  
      }
  </code></pre>