# HtmlUrlPolicy

Shared URL policy used by OfficeIMO HTML ingestion adapters before links or resource references are materialized.

Class 

`OfficeIMO.Html`

**Namespace**

`OfficeIMO.Html`

**Assembly**

`OfficeIMO.Html`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[HtmlUrlPolicy.cs:71](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L71)

**Modifiers**

sealed

Shared URL policy used by OfficeIMO HTML ingestion adapters before links or resource references are materialized.

## Inheritance

- object
- HtmlUrlPolicy

## Usage

Explore 29 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 15

- Property [HtmlConversionDocumentOptions.ResourceUrlPolicy](/api/html/officeimo-html-htmlconversiondocumentoptions/#property-resourceurlpolicy)
- Property [HtmlConversionDocumentOptions.UrlPolicy](/api/html/officeimo-html-htmlconversiondocumentoptions/#property-urlpolicy)
- Property [HtmlNormalizationOptions.ResourceUrlPolicy](/api/html/officeimo-html-htmlnormalizationoptions/#property-resourceurlpolicy)
- Property [HtmlNormalizationOptions.UrlPolicy](/api/html/officeimo-html-htmlnormalizationoptions/#property-urlpolicy)
- Property [HtmlRenderOptions.ResourceUrlPolicy](/api/html/officeimo-html-htmlrenderoptions/#property-resourceurlpolicy)
- Property [HtmlRenderOptions.UrlPolicy](/api/html/officeimo-html-htmlrenderoptions/#property-urlpolicy)
- Property [HtmlResourcePipelineOptions.ResourceUrlPolicy](/api/html/officeimo-html-htmlresourcepipelineoptions/#property-resourceurlpolicy)
- Property [HtmlResourcePipelineOptions.UrlPolicy](/api/html/officeimo-html-htmlresourcepipelineoptions/#property-urlpolicy)
- Property [HtmlResourceSession.ResourcePolicy](/api/html/officeimo-html-htmlresourcesession/#property-resourcepolicy)
- Method [HtmlUrlPolicy.Clone](/api/html/officeimo-html-htmlurlpolicy/#method-clone)
- Method [HtmlUrlPolicy.CreateEmbeddedResourceProfile](/api/html/officeimo-html-htmlurlpolicy/#method-createembeddedresourceprofile)
- Method [HtmlUrlPolicy.CreateHyperlinkProfile](/api/html/officeimo-html-htmlurlpolicy/#method-createhyperlinkprofile)
- Method [HtmlUrlPolicy.CreateOfficeIMOProfile](/api/html/officeimo-html-htmlurlpolicy/#method-createofficeimoprofile)
- Method [HtmlUrlPolicy.CreateWebOnlyProfile](/api/html/officeimo-html-htmlurlpolicy/#method-createwebonlyprofile)
- Method [HtmlUrlPolicy.CreateWebResourceProfile](/api/html/officeimo-html-htmlurlpolicy/#method-createwebresourceprofile)

### Accepted by parameters 14

- Method [HtmlImageSourceResolver.ResolveFirstSrcSetCandidate](/api/html/officeimo-html-htmlimagesourceresolver/#method-resolvefirstsrcsetcandidate-string-uri-officeimo-html-htmlurlpolicy) parameter `policy`
- Method [HtmlImageSourceResolver.ResolveImageSource](/api/html/officeimo-html-htmlimagesourceresolver/#method-resolveimagesource-officeimo-html-dom-htmlelement-uri-officeimo-html-htmlurlpolicy-boolean) parameter `policy`
- Method [HtmlImageSourceResolver.ResolveImageSourceCandidates](/api/html/officeimo-html-htmlimagesourceresolver/#method-resolveimagesourcecandidates-officeimo-html-dom-htmlelement-uri-officeimo-html-htmlurlpolicy-boolean-nullable-system-int32) parameter `policy`
- Method [HtmlImageSourceResolver.ResolveNormalizedSrcSet](/api/html/officeimo-html-htmlimagesourceresolver/#method-resolvenormalizedsrcset-string-uri-officeimo-html-htmlurlpolicy) parameter `policy`
- Method [HtmlImageSourceResolver.ResolveNormalizedSrcSetAttributes](/api/html/officeimo-html-htmlimagesourceresolver/#method-resolvenormalizedsrcsetattributes-officeimo-html-dom-htmlelement-uri-officeimo-html-htmlurlpolicy-string) parameter `policy`
- Method [HtmlImageSourceResolver.ResolvePictureSource](/api/html/officeimo-html-htmlimagesourceresolver/#method-resolvepicturesource-officeimo-html-dom-htmlelement-uri-officeimo-html-htmlurlpolicy) parameter `policy`
- Method [HtmlImageSourceResolver.ResolvePictureSourceCandidates](/api/html/officeimo-html-htmlimagesourceresolver/#method-resolvepicturesourcecandidates-officeimo-html-dom-htmlelement-uri-officeimo-html-htmlurlpolicy) parameter `policy`
- Method [HtmlImageSourceResolver.ResolveSrcSetCandidates](/api/html/officeimo-html-htmlimagesourceresolver/#method-resolvesrcsetcandidates-string-uri-officeimo-html-htmlurlpolicy) parameter `policy`
- Method [HtmlImageSourceResolver.ResolveUrlAttributes](/api/html/officeimo-html-htmlimagesourceresolver/#method-resolveurlattributes-officeimo-html-dom-htmlelement-uri-officeimo-html-htmlurlpolicy-string) parameter `policy`
- Method [HtmlImageSourceResolver.ResolveUrlFromSrcSet](/api/html/officeimo-html-htmlimagesourceresolver/#method-resolveurlfromsrcset-string-uri-officeimo-html-htmlurlpolicy) parameter `policy`
- Method [HtmlImageSourceResolver.ResolveUrlFromSrcSetAttributes](/api/html/officeimo-html-htmlimagesourceresolver/#method-resolveurlfromsrcsetattributes-officeimo-html-dom-htmlelement-uri-officeimo-html-htmlurlpolicy-string) parameter `policy`
- Constructor [HtmlResourceSession.HtmlResourceSession](/api/html/officeimo-html-htmlresourcesession/#constructor-ctor-officeimo-html-htmlurlpolicy-officeimo-html-htmlrenderresourceresolver-nullable-system-timespan-int32-int64-int64-int32-int32-int32) parameter `resourcePolicy`
- Method [HtmlUrlPolicyEvaluator.IsAllowed](/api/html/officeimo-html-htmlurlpolicyevaluator/#method-isallowed-string-officeimo-html-htmlurlpolicy-boolean) parameter `policy`
- Method [HtmlUrlPolicyEvaluator.ResolveUrl](/api/html/officeimo-html-htmlurlpolicyevaluator/#method-resolveurl-string-uri-officeimo-html-htmlurlpolicy-boolean) parameter `policy`

Filter members 

Show inherited

## Constructors

`public HtmlUrlPolicy()` [#](#constructor-ctor)

[HtmlUrlPolicy.cs:71](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L71)

## Methods

`public HtmlUrlPolicy Clone()` [#](#method-clone)

[HtmlUrlPolicy.cs:119](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L119)

Creates a copy of the current policy instance.

Returns

`HtmlUrlPolicy`

`public static HtmlUrlPolicy CreateEmbeddedResourceProfile()` [#](#method-createembeddedresourceprofile)

[HtmlUrlPolicy.cs:56](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L56)

Creates an offline resource policy that accepts bounded embedded data while rejecting file and network schemes.

Returns

`HtmlUrlPolicy`

`public static HtmlUrlPolicy CreateHyperlinkProfile()` [#](#method-createhyperlinkprofile)

[HtmlUrlPolicy.cs:18](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L18)

Creates a hyperlink policy that rejects script, file, and data URLs while allowing common web, mail, and telephone links.

Returns

`HtmlUrlPolicy`

`public static HtmlUrlPolicy CreateOfficeIMOProfile()` [#](#method-createofficeimoprofile)

[HtmlUrlPolicy.cs:13](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L13)

Creates the default OfficeIMO URL policy for trusted compatibility-oriented HTML ingestion.

Returns

`HtmlUrlPolicy`

`public static HtmlUrlPolicy CreateWebOnlyProfile()` [#](#method-createwebonlyprofile)

[HtmlUrlPolicy.cs:28](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L28)

Creates a restrictive web-only policy that accepts only HTTP, HTTPS, mail, and telephone links.

Returns

`HtmlUrlPolicy`

`public static HtmlUrlPolicy CreateWebResourceProfile()` [#](#method-createwebresourceprofile)

[HtmlUrlPolicy.cs:40](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L40)

Creates a resource policy that accepts only HTTP and HTTPS network references. Mail, telephone, script, file, and data URLs are rejected.

Returns

`HtmlUrlPolicy`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public bool DisallowScriptUrls { get; set; }` [#](#property-disallowscripturls)

[HtmlUrlPolicy.cs:71](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L71)

When true, script-like URL schemes such as javascript: and vbscript: are rejected.

`public bool DisallowFileUrls { get; set; }` [#](#property-disallowfileurls)

[HtmlUrlPolicy.cs:76](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L76)

When true, file: URLs and Windows drive-path URL targets are rejected.

`public bool AllowMailtoUrls { get; set; }` [#](#property-allowmailtourls)

[HtmlUrlPolicy.cs:81](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L81)

When false, mailto: URLs are rejected.

`public bool AllowDataUrls { get; set; }` [#](#property-allowdataurls)

[HtmlUrlPolicy.cs:86](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L86)

When false, data: URLs are rejected.

`public bool AllowProtocolRelativeUrls { get; set; }` [#](#property-allowprotocolrelativeurls)

[HtmlUrlPolicy.cs:91](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L91)

When false, protocol-relative URLs such as //example.com/image.png are rejected unless callers resolve them first.

`public bool RestrictUrlSchemes { get; set; }` [#](#property-restricturlschemes)

[HtmlUrlPolicy.cs:97](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L97)

When true, absolute URLs must use a scheme listed in [HtmlUrlPolicy.AllowedUrlSchemes](/api/html/officeimo-html-htmlurlpolicy/). Relative URLs and fragments are still allowed by the evaluator.

`public Func<string, string?>? ResolvedUrlTransform { get; set; }` [#](#property-resolvedurltransform)

[HtmlUrlPolicy.cs:104](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L104)

Optional trusted transform applied after a URL passes policy checks and base-URI resolution. Return null or an empty string to reject the resolved URL. Transformed values are checked against this policy again before use.

`public HashSet<string> AllowedUrlSchemes { get; }` [#](#property-allowedurlschemes)

[HtmlUrlPolicy.cs:109](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Policies/HtmlUrlPolicy.cs#L109)

URL schemes allowed when [HtmlUrlPolicy.RestrictUrlSchemes](/api/html/officeimo-html-htmlurlpolicy/) is enabled.

<!-- PowerForge markdown artifact sha256:36028FBCB6E4FBF165AA228D0D428CC119581E2B81BECDB1B565193CBB272CD6 -->
