AssetPath class

Namespace Runic.Assets in Runic.Assets 0.23.0

public static class AssetPath

Validates application-relative asset paths at every trust boundary.

Methods

Normalize

public static string Normalize(string value)

Returns the canonical slash-separated form of a safe application-relative path.

Exceptions

ArgumentException

The path is empty, rooted, ambiguous, or contains unsupported characters.

TryNormalize

public static bool TryNormalize(string? value, out string? normalized)

Returns whether a path is a safe application-relative asset path and, if so, its canonical slash-separated form. Use this for untrusted request paths; it never throws.