HtmlLoadOptions.WebRequestTimeout

HtmlLoadOptions WebRequestTimeout property. The number of milliseconds to wait before the web request times out. The default value is 100000 milliseconds 100 seconds.

HtmlLoadOptions.WebRequestTimeout property

The number of milliseconds to wait before the web request times out. The default value is 100000 milliseconds (100 seconds).

public int WebRequestTimeout { get; set; }

Remarks

The number of milliseconds that Wordize waits for a response, when loading external resources (images, style sheets) linked in HTML and MHTML documents.

Examples

Shows how to set a time limit for web requests when loading a document with external resources linked by URLs.

// This linked image will require a web request to load, which will have to complete within our time limit.
string html = $@"
    <html>
        <img src=""{ImageUrl}"" alt=""Aspose logo"" style=""width:400px;height:400px;"">
    </html>";
MemoryStream htmlStream = new MemoryStream(Encoding.UTF8.GetBytes(html));

HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
// Set an unreasonable timeout limit and try load the document. The image will not be loaded.
htmlLoadOptions.WebRequestTimeout = 0;

Converter.Create()
    .From(htmlStream, htmlLoadOptions)
    .To(ArtifactsDir + "HtmlLoadOptions.WebRequestTimeout.docx")
    .Execute();

See Also