# HtmlResourceSession

Operation-scoped owner for HTML resource policy, resolution, MIME validation, deduplication, caching, budgets, timeouts, cancellation evidence, canonical…

Class 

`OfficeIMO.Html`

**Namespace**

`OfficeIMO.Html`

**Assembly**

`OfficeIMO.Html`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[HtmlResourceSession.FontBudgets.cs:6](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlResourceSession.FontBudgets.cs#L6)

**Modifiers**

sealed

Operation-scoped owner for HTML resource policy, resolution, MIME validation, deduplication, caching, budgets, timeouts, cancellation evidence, canonical identities, and content digests.

## Inheritance

- object
- HtmlResourceSession

## Usage

Explore 2 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 2

- Method [HtmlResourceSession.Resolve](/api/html/officeimo-html-htmlresourcesession/#method-resolve-officeimo-html-htmlresourcemanifest-officeimo-html-htmlrenderoptions-officeimo-html-htmldiagnosticreport-threading-cancellationtoken)
- Method [HtmlResourceSession.ResolveAsync](/api/html/officeimo-html-htmlresourcesession/#method-resolveasync-officeimo-html-htmlresourcemanifest-officeimo-html-htmlrenderoptions-officeimo-html-htmldiagnosticreport-threading-cancellationtoken)

Filter members 

Show inherited

## Constructors

`public HtmlResourceSession(HtmlUrlPolicy? resourcePolicy = null, HtmlRenderResourceResolver? resolver = null, TimeSpan? resourceTimeout = null, int maxConcurrentLoads = 8, long maxResourceBytes = 10485760, long maxTotalResourceBytes = 52428800, int maxResourceCount = 256, int maxResourceRequests = 512, int maxStylesheetImportDepth = 16)` [#](#constructor-ctor-officeimo-html-htmlurlpolicy-officeimo-html-htmlrenderresourceresolver-nullable-system-timespan-int32-int64-int64-int32-int32-int32)

[HtmlRenderResourceLoader.cs:11](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L11)

Creates an independent resource session.

Parameters

**resourcePolicy OfficeIMO.Html.HtmlUrlPolicy? = null optional**

**resolver OfficeIMO.Html.HtmlRenderResourceResolver? = null optional**

**resourceTimeout System.TimeSpan? = null optional**

**maxConcurrentLoads int = 8 optional**

**maxResourceBytes long = 10485760 optional**

**maxTotalResourceBytes long = 52428800 optional**

**maxResourceCount int = 256 optional**

**maxResourceRequests int = 512 optional**

**maxStylesheetImportDepth int = 16 optional**

## Methods

`public static HtmlResourceSession Resolve(HtmlResourceManifest manifest, HtmlRenderOptions options, HtmlDiagnosticReport? diagnostics = null, CancellationToken cancellationToken = default)` [#](#method-resolve-officeimo-html-htmlresourcemanifest-officeimo-html-htmlrenderoptions-officeimo-html-htmldiagnosticreport-threading-cancellationtoken)

[HtmlRenderResourceLoader.cs:114](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L114)

Resolves a manifest synchronously using the configured synchronous package resolver, when present.

Parameters

**manifest OfficeIMO.Html.HtmlResourceManifest required**

**options OfficeIMO.Html.HtmlRenderOptions required**

**diagnostics OfficeIMO.Html.HtmlDiagnosticReport? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`HtmlResourceSession`

`public static Task<HtmlResourceSession> ResolveAsync(HtmlResourceManifest manifest, HtmlRenderOptions options, HtmlDiagnosticReport? diagnostics = null, CancellationToken cancellationToken = default)` [#](#method-resolveasync-officeimo-html-htmlresourcemanifest-officeimo-html-htmlrenderoptions-officeimo-html-htmldiagnosticreport-threading-cancellationtoken)

[HtmlRenderResourceLoader.cs:127](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L127)

Resolves a manifest asynchronously using one operation-scoped session.

Parameters

**manifest OfficeIMO.Html.HtmlResourceManifest required**

**options OfficeIMO.Html.HtmlRenderOptions required**

**diagnostics OfficeIMO.Html.HtmlDiagnosticReport? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<HtmlResourceSession>`

`public bool TryGet(string? source, string? resolvedSource, out HtmlResolvedResource resource)` [#](#method-tryget-string-string-officeimo-html-htmlresolvedresource)

[HtmlRenderResourceLoader.cs:350](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L350)

Gets a cached resource by original or canonical source.

Parameters

**source string? required**

**resolvedSource string? required**

**resource OfficeIMO.Html.HtmlResolvedResource required**

Returns

`bool`

## 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 HtmlUrlPolicy ResourcePolicy { get; }` [#](#property-resourcepolicy)

[HtmlRenderResourceLoader.cs:64](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L64)

Resource URL policy snapshot owned by this operation.

`public HtmlRenderResourceResolver? Resolver { get; }` [#](#property-resolver)

[HtmlRenderResourceLoader.cs:67](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L67)

Asynchronous application resolver snapshot owned by this operation.

`public TimeSpan ResourceTimeout { get; }` [#](#property-resourcetimeout)

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

Deadline after which one resolver invocation's cancellation token is cancelled.

`public int MaxConcurrentLoads { get; }` [#](#property-maxconcurrentloads)

[HtmlRenderResourceLoader.cs:74](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L74)

Maximum concurrent asynchronous resolver invocations.

`public long MaxResourceBytes { get; }` [#](#property-maxresourcebytes)

[HtmlRenderResourceLoader.cs:77](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L77)

Maximum accepted bytes for one resource.

`public long MaxTotalResourceBytes { get; }` [#](#property-maxtotalresourcebytes)

[HtmlRenderResourceLoader.cs:80](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L80)

Maximum accepted bytes for the operation.

`public int MaxResourceCount { get; }` [#](#property-maxresourcecount)

[HtmlRenderResourceLoader.cs:83](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L83)

Maximum accepted resource count.

`public int MaxResourceRequests { get; }` [#](#property-maxresourcerequests)

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

Maximum attempted resolver requests.

`public int MaxStylesheetImportDepth { get; }` [#](#property-maxstylesheetimportdepth)

[HtmlRenderResourceLoader.cs:89](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L89)

Maximum external stylesheet import depth.

`public HtmlDiagnosticReport Diagnostics { get; }` [#](#property-diagnostics)

[HtmlRenderResourceLoader.cs:92](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L92)

Diagnostics emitted by this session.

`public IReadOnlyList<HtmlResourceSessionEntry> Resources { get; }` [#](#property-resources)

[HtmlRenderResourceLoader.cs:95](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L95)

Accepted canonical resources in acceptance order.

`public long AcceptedResourceBytes { get; private set; }` [#](#property-acceptedresourcebytes)

[HtmlRenderResourceLoader.cs:100](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L100)

Total accepted encoded bytes.

`public int AcceptedResourceCount { get; private set; }` [#](#property-acceptedresourcecount)

[HtmlRenderResourceLoader.cs:103](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L103)

Number of accepted deduplicated resources.

`public int ResolverRequestCount { get; }` [#](#property-resolverrequestcount)

[HtmlRenderResourceLoader.cs:106](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlRenderResourceLoader.cs#L106)

Number of resolver requests reserved by the session.

`public long DecodedFontBytes { get; private set; }` [#](#property-decodedfontbytes)

[HtmlResourceSession.FontBudgets.cs:6](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Rendering/HtmlResourceSession.FontBudgets.cs#L6)

Accepted decoded font bytes retained by the operation, including nested documents and installed fallback faces. Encoded resource bytes remain separate.

<!-- PowerForge markdown artifact sha256:CF5FF70E69F9838FBE8AFD28AF13907393578DB5C5339BBAD77097D5E8BC7700 -->
