I have this code when loading the url:

```
private List<string> test(string url, int levels,DoWorkEventArgs eve)
        {
            HtmlWeb hw = new HtmlWeb();
            List<string> webSites;
            try
            {
                this.Invoke(new MethodInvoker(delegate { Texts(richTextBox1, "Loading The Url: " + url + "..." , Color.Red); }));
                doc = hw.Load(url);
                this.Invoke(new MethodInvoker(delegate { Texts(richTextBox1, "Done " + Environment.NewLine, Color.Red); }));

```

Sometimes when its Loading the url its taking a lot fo time since the website in the url variable is not responding.
I want to add a timeout so lets say after X seconds it will throw a message like " there was a timeout".

Now HtmlAgilityPack does not have any timeout property or class.
So i thought to create a new function in my Form1 that will use webrequest and webresponde and set a timeout in this new function then calling this function before loading the url.

Can someone show me how to make the new function to work with my code ?
Also with a timeout.

Thanks.