SkipExternalResources

PresentationLoadOptions.SkipExternalResources property

Gets or sets whether external resources are denied. Default: true.

public bool SkipExternalResources { get; set; }

Remarks

When true, a document still loads:

  • content it carries: data: URIs, cid: references, MHTML parts and packaged media;
  • about: and base64 references;
  • local files inside the base directory;
  • resources that match an entry of WhitelistedResources.

Everything else is skipped and the conversion continues: http, https, ftp and every other scheme, local files outside the base directory, and relative references that leave it through ../.

The base directory is BasePath when the options are WebLoadOptions and it names a local directory. Otherwise it is the folder of the source file when the document is converted from a file path, and there is none when it is converted from a stream. An http or https``BasePath, a UNC BasePath and a source file on a UNC share give no base directory. Symbolic links and junctions inside the base directory are not resolved, so it should hold only content you trust.

When false, every external resource loads except UNC paths, the whitelist has no effect, and the engine follows redirects.

UNC paths (\\host\share, //host/share, file://host/share and their other forms) are never loaded, whatever this property is set to.

An ExternalResourceHandler receives this decision for each resource and can override it, except for UNC paths, javascript: and vbscript: references and XBRL taxonomies.

See Also