aspNetEmail

HtmlUtility.TimeOut Property

The timeout (in ms) used when retrieving data from a http:// location.

public int TimeOut {get; set;}

Remarks

By default this value is 30000ms (30 seconds).

Example

[C#]
            HtmlUtility utility = new HtmlUtility();
            string url = "http://www.microsoft.com";
            
            //convert linked css sheets to inline <style> content
            utility.CssOption = CssOption.EmbedLinkedSheets;
            
            //set the UrlContent base
            utility.SetUrlContentBase = true;
            
            //set the basetag in the html
            utility.SetHtmlBaseTag = true;
            
            //resolve Hrefs so they are absolute
            utility.ResolveHrefs = true;
            
            //embed the images
            utility.EmbedImageOption  = EmbedImageOption.ContentLocation;
            
            //impersonate IE v5.5
            utility.UserAgent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; .NET CLR 1.0.3705)";
            
            //pretend the request was previously made from viewing www.microsoft.com
            utility.Referrer = "http://www.microsoft.com";
            
            //set the timout to 60 seconds
            utility.TimeOut = 60000;
            
            //load the Html content from the url
            utility.LoadUrl( url );
            
            //render the Html so it is properly formatted for email
            utility.Render();
            
            //create an EmailMessage with appropriate text and html parts
            EmailMessage email = utility.ToEmailMessage();
            
            //load To, From, Server, etc... values from the web.config
            email.LoadFromConfig();
            
            email.Subject = "Html Utility Test";
            
            email.Send();
            
            
[VB.NET]
            Dim utility As New HtmlUtility()
            
            Dim url As String = "http://www.microsoft.com"
            
            'convert linked css sheets to inline <style> content
            utility.CssOption = CssOption.EmbedLinkedSheets
            
            'set the UrlContent base
            utility.SetUrlContentBase = True
            
            'set the basetag in the html
            utility.SetHtmlBaseTag = True
            
            'resolve Hrefs so they are absolute
            utility.ResolveHrefs = True
            
            'embed the images
            utility.EmbedImageOption = EmbedImageOption.ContentLocation
            
            'impersonate IE v5.5
            utility.UserAgent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; .NET CLR 1.0.3705)"
            
            'pretend the request was previously made from viewing www.microsoft.com
            utility.Referrer = "http://www.microsoft.com"
            
            'set the timout to 60 seconds
            utility.TimeOut = 60000
            
            'load the Html content from the url
            utility.LoadUrl(url)
            
            'render the Html so it is properly formatted for email
            utility.Render()
            
            'create an EmailMessage with appropriate text and html parts
            Dim email As EmailMessage = utility.ToEmailMessage()
            
            'load To, From, Server, etc... values from the web.config
            email.LoadFromConfig()
            
            email.Subject = "Html Utility Test"
            
            email.Send()
            
            

See Also

HtmlUtility Class | aspNetEmail Namespace