Language

SessionIsolationKeyProvider.GetSessionIsolationKeyAsync Method

Definition

Asynchronously retrieves the session isolation key for the current request or execution context.

public abstract System.Threading.Tasks.ValueTask<string?> GetSessionIsolationKeyAsync(System.Threading.CancellationToken cancellationToken = default);
abstract member GetSessionIsolationKeyAsync : System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<string>
Public MustOverride Function GetSessionIsolationKeyAsync (Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of String)

Parameters

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests.

Returns

A task that represents the asynchronous operation. The task result contains the isolation key string, or null if no key is available in the current context.

Remarks

Implementations should extract the key from ambient context (e.g., HTTP request headers, claims, or environment variables). If the key cannot be determined, return null to allow the caller to decide on strict vs. pass-through behavior.

Applies to