Exception "Failed to Parse Base URL" when loading HTML using Aspose.HTML for .NET

We are using Aspose.HTML 19.12.0 on .NET.
We are attempting to load an HTML document from content in a stream, as folllows:
HTMLDocument document = new HTMLDocument(htmlStream, “”);
The error produced sometimes is:
Failed to parse base URL. at . [T](String , Object[] ) at .(String , Object[] ) at Aspose.Html.Url…ctor(String url, String baseUrl) at
.(Stream , String ) at Aspose.Html.HTMLDocument…ctor(Stream content, String baseUri)

The odd thing is that, for the same data, this sometimes occurs and sometimes not. I cannot find a way to reliably reproduce. The baseUri provided to the constructor is simply an empty string. Would an upgrade help with this issue? I currently can’t view release notes, as docs.aspose.com is encountering a 403 HTTP error.

@jamesaflagg,

Thanks for contacting support.

Can you please share source HTML file so that we may further investigate to help you out. Before sharing requested information can you please try to use Aspose.HTML latest version 20.2 on your end.

tif generation sample.zip (701 Bytes)

Sample attached. It is unremarkable HTML. There is one image included, based on a reference to a file on a local file system. I have tried with both a valid and invalid image path. In both cases we cannot reproduce this issue reliably.

A further observation - we have two production servers, with the same set of libraries deployed on each. An identical copy of the same Aspose.Total license file is also deployed on each. At any given point in time, one of the two servers will encounter this error, and the other will work fine. Sometimes it switches. Is there anything in the system environment which could affect “Base URL”

@jamesaflagg,

I have worked with source file using Aspose.HTML and unable to observe the issue. Can you please share complete environment details with us so that we may further investigate to help you out.

@Adnan.Ahmad, thank you for the response.
I also cannot reproduce the issue on my own development environment, nor our QA environment.

Environment where the issue sometimes occurs:

  • Windows Server 2012 Standard
  • 32 GB RAM, Xeon Silver 4110 CPU, 6 processors
  • ASP.NET Web Application targeting .NET Framework 4.7.2
  • IIS 8
  • Aspose.HTML version 19.9, but next week we will update to 20.2

Maybe the upgrade will make a difference, but it looks like the APIs are the same and I don’t see anything relevant in the release notes.

@jamesaflagg,

I like to inform that as per company policy support is always provided based on latest version. Can you please try to update Aspose.HTML version and share feedback with us if there is still an issue.

We have upgraded to Aspose.HTML 20.2 for .NET. Runtime environment is otherwise the same as my previous post. The problem still occurs. It is sporadic, but once it begins happening in the web application it generally continues to occur until a reboot or IIS restart is performed. What other options do we have?

base url issue.png (3.0 KB)

@jamesaflagg,

I like to inform that mentioned issue cannot be reproduce in our environment but still we would investigate it in details and try to find the reason behind it as it seems environment specific. We have logged an investigation ticket as HTMLNET-2494 in our issue tracking system. We will further investigate the scenario in details and will share feedback with you soon.