PathToUrlMapper.TryTransformUrl Method
- Namespace
- Kampute.DocToolkit.Routing
- Assembly
- Kampute.DocToolkit.dll
Definition
Attempts to transform a URL string to its corresponding replacement URL.
public bool TryTransformUrl(string urlString, [NotNullWhen(true)] out Uri replacementUrl)Parameters
urlStringstring- The URL string to find a replacement for.
replacementUrlUri- When this method returns, contains the replacement URL if found; otherwise,
null.

- It attempts to match both URL-encoded and decoded path variations
- It tries matching paths both with and without file extensions
When a match is found, the method preserves fragment identifier of the original URL and combines its query parameters with any existing query parameters in the mapped URL. This ensures that the full context of the original URL is retained in the replacement URL.