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

Free Support Forum - aspose.com

Prevent from accessing Internet


I would like Aspose.Words to prevent from accessing internet when parsing in my case mhtml documents. Is there a way to tell words not to download images, but only use what is embedded?


A class implementing the IResourceLoadingCallback interface can be used to control how resources such as images or CSS are handled when they need to be downloaded from an external source i.e a network or internet. Please see the following example which bans all network resources from loading:

Aspose.Words.Loading.LoadOptions loadOptions = new Aspose.Words.Loading.LoadOptions();
loadOptions.LoadFormat = LoadFormat.Mhtml;
loadOptions.ResourceLoadingCallback = new HandleResourceLoading();

Document doc = new Document(@"C:\Temp\in.mhtml", loadOptions);

public class HandleResourceLoading : IResourceLoadingCallback
    public ResourceLoadingAction ResourceLoading(ResourceLoadingArgs args)
        return ResourceLoadingAction.Skip;