We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert MHTML to DOCX Word Document using C# | Set Web Request Timeout for Loading MHT File

hi,
when I load the attached mht, it’s very long.
i think it’s because of links to images which are no longer available.
I try to set HtmlLoadOptions.WebRequestTimeout to 10000, but it doesn’t change anything.
Is there a mean to limit the time spent to try to load the images ?
thanks in advance.

the code is :

Aspose.Words.HtmlLoadOptions lo = new Aspose.Words.HtmlLoadOptions();
lo.WebRequestTimeout = 10000;
//create an instance of Document and load the MTHML from MemoryStream
Document doc = new Document("c:\\temp\\msgmma\\test1.mht", lo);

test1.zip (8.8 KB)

@tparassin,
Yes, you can use HtmlLoadOptions.WebRequestTimeout property to adjust Web Request Timeout. Please try using the following code:

HtmlLoadOptions opts = new HtmlLoadOptions();
opts.LoadFormat = LoadFormat.Mhtml;
opts.WebRequestTimeout = 1000;
Document doc = new Document("E:\\temp\\test1.mht", opts);
doc.Save("E:\\temp\\20.3.docx");

thanks for your help.