I am writing a parser and faced such a problem. In the absence of an Internet connection, a program that logically crashes, or when the server does not respond in time.
public string WebsiteToString(string url) { try { WebClient wc = new WebClient(); wc.Headers["User-Agent"] = "MOZILLA/5.0 (WINDOWS NT 6.1; WOW64) APPLEWEBKIT/537.1 (KHTML, LIKE GECKO) CHROME/21.0.1180.75 SAFARI/537.1"; html = wc.DownloadString(url); } catch { MessageBox.Show("Проблемы с интернетом"); } return html; } How can I add in this construction that the program itself in 5 minutes try again to get the data?