If you use DocumentBuilder to insert html that requires Aspose Words retrieve assets from the web Aspose identifies as IE5 in those requests, specifically as “Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0)”.
This is ancient, and while ident strings shouldn’t be used for anything they often are, especially by application firewalls and by auditors who like to raise red flags, and especially when it’s something “ancient” like IE5.
Is there a way we can set the user-agent string used in the requests? Or can you at least update that string to something current-ish.
Thx,
-Walden
The code sample below will result in the request to server.com coming from “Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0)”
var d = new Aspose.Words.Document();
var db = new DocumentBuilder(d);
db.InsertHtml("<img src='https://server.com/image.png'/>");
@WaldenL Unfortunately, currently there is no way to specify UserAgent. I have logged this feature request as WORDSNET-23498, we will consider providing such possibility.
However, you can use IResourceLoadingCallback and implement your own method for loading external resources, where you can specify UserAgent.
This (the resource loading callback) also solves a different issue raised by our auditors about a potential server-side request forgery where Aspose could be used as an attack vector if an attacker “setup a server that redirects to arbitrary hosts within the requesting server’s intranet to perform blind requests.” Now we can filter those requests too. Awesome!
@WaldenL It is perfect that IResourceLoadingCallback allows implementing what you need. Please feel free to ask in case of any issues. We are always glad to help.