Hi everyone im trying to create a method that will always return a url source, if for example internet goes off it will continue working until it comes up and return the url source and so on if something else occurs. So far in my method when i "turn off" the internet and "turn it on" back procedures continue normaly **but im having an issue when a timeout occurs and im "falling" in a loop** i know that the while(true) is not the right approach but im using it for my tests.

So how can i skip the timeout exception and "retry" my method?

```
public static async Task<string> GetUrlSource(string url)
{
    string source = "";
    while (true)
    {
        HttpWebRequest hwr = (HttpWebRequest)WebRequest.Create(url);
        hwr.AllowAutoRedirect = true;
        hwr.UserAgent = UserAgent;
        hwr.Headers.Add(hd_ac_lang[0], hd_ac_lang[1]);
        hwr.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
        hwr.Timeout = 14000;
        try
        {
            using (var response = hwr.GetResponse())
            {
                using (var reader = new StreamReader(response.GetResponseStream()))
                {
                    source = await reader.ReadToEndAsync();
                    if (check_source(source))
                    {
                        return source;
                    }
                 }
             }
         }
         catch (WebException ex)
         {
             hwr.Abort();
             if (ex.Status == WebExceptionStatus.ProtocolError)
             {
                if (((HttpWebResponse)ex.Response).StatusCode == HttatusCode.NotFound)
                {
                    // handle the 404 here
                    return "404";
                 }
              }
              else
              {
                 Console.WriteLine(ex.Status.ToString());    
              }
         }
    }
}

```

**Note:** i used to have the hwr.Abort(); into a finnaly clause but it didnt help.

**Edit:** the console is writting this message every 14 seconds as my timeout i think its something related with that.