UriExtensions Class
Helpers for adding parameters to a URI's query or fragment and for extracting standard parts (origin, trailing slash). Empty or null parameter values are dropped rather than serialized as bare keys, matching the OAuth 2.0 / OpenID Connect convention for absent parameters.
public static class UriExtensionsInheritance System.Object → UriExtensions
Methods
UriExtensions.AppendTrailingSlash(this string) Method
Appends a trailing slash to a URI string if it does not already end with one.
public static string AppendTrailingSlash(this string uri);Parameters
uri System.String
The URI string to which a trailing slash will be appended.
Returns
System.String
A string representing the URI with a trailing slash.
UriExtensions.GetOrigin(this Uri) Method
Retrieves the origin (scheme, host, and optionally port) of the given URI.
public static string GetOrigin(this System.Uri uri);Parameters
uri System.Uri
The URI from which the origin will be extracted.
Returns
System.String
A string representing the origin of the URI.