DocumentUrlContext.TryResolveUrl Method

Namespace
Kampute.DocToolkit.Routing
Assembly
  • Kampute.DocToolkit.dll

Definition

Attempts to resolve a documentation-root-relative URL into an absolute or document-relative URL.
public bool TryResolveUrl(string url, [NotNullWhen(true)] out string resolvedUrl)

Parameters

url string
A URL beginning with ~/, where the marker represents the documentation root rather than the web site's root.
resolvedUrl string
When this method returns, contains the resolved URL if resolution succeeded; otherwise, null.

Returns

bool
true if the URL was successfully resolved; otherwise, false.

Remarks

URLs are interpreted according to their prefix and the active document context:

  • A documentation-root-relative URL beginning with ~/ is resolved from the documentation root.
  • A site-root-relative URL beginning with / is not resolved.
  • An ordinary document-relative URL is not resolved.
  • Query strings and fragments are preserved.
  • Dot segments are resolved within the documentation root; a path that navigates above that root is not resolved.
The operation preserves the query string and fragment components of the URL, if present.