WhitelistedResources

ThreeDLoadOptions.WhitelistedResources property

Gets or sets the absolute URI prefixes of the external resources that load while SkipExternalResources is true.

public IList<string> WhitelistedResources { get; set; }

Remarks

Each entry is an absolute URI prefix, such as https://cdn.example.com/assets/ or file:///C:/assets/. A resource matches an entry when:

  • its scheme and host equal the entry’s, ignoring case, with no subdomain matching;
  • its port equals the entry’s once the scheme’s default port is filled in;
  • its path starts with the entry’s path at a / boundary, case-sensitively, so /assets does not match /assetsX.

The resource is resolved against its base first. Local paths become file: URIs, dot segments are removed, and the query and fragment are ignored. A resource holding an encoded /, \ or . never matches.

An entry that is null, empty, not an absolute URI, carries a query or fragment, or contains %2F, %5C or %2E makes the load fail with InvalidLoadOptionsException, whatever SkipExternalResources is set to. A file extension or a host name on its own, such as jpg or example.com, is not a valid entry.

A UNC resource never loads, even when an entry matches it.

The engine follows redirects: a whitelisted URL that redirects loads the redirect target, even when the target is not whitelisted.

The list is copied when the document loads, and a null list counts as empty. The whitelist has no effect while SkipExternalResources is false.

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

See Also