public static class NavigationRouteLinks Reads route paths from deep links: URLs with the application's scheme or of its web-link hosts.
Methods
TryGetRoute
public static bool TryGetRoute(Uri uri, IEnumerable<string> schemes, out string? route, IEnumerable<string>? webLinkHosts = null) Gets the route path of uri: for a URL with one of schemes, such as myapp://invoice/7 or myapp:invoice/7, its host and path (invoice/7); for an https URL of one of webLinkHosts, its path. The query and the fragment are dropped.
Returns
false for any other URI, or one with user information, an empty route, a route longer than 2048 characters or a control character.
Remarks
The URI is untrusted input: the route still has to match a route of the map, and the page it opens should confirm anything destructive. Schemes and hosts are compared without regard to case.
Uri normalizes the host of myapp://Invoice/7: it is lowercased and converted to its IDN (punycode) form. A route whose first segment is a string parameter, such as {customer}/orders, therefore receives that segment lowercased and possibly as xn--…. Put such parameters after a literal first segment, or use myapp:customer/… without //.