UriBuilder Class
A wrapper around System.UriBuilder, providing enhanced functionality for URI manipulation, specifically for handling query strings and fragments.
public class UriBuilderInheritance System.Object → UriBuilder
Constructors
UriBuilder(string) Constructor
Initializes a new instance of the UriBuilder class with the specified URI string. Automatically detects and handles both absolute URIs and relative paths.
public UriBuilder(string uri);Parameters
uri System.String
A URI string to use as the base of the UriBuilder. Can be an absolute URI (e.g., "https://example.com/path"\) or a relative path (e.g., "/path").
UriBuilder(Uri) Constructor
Initializes a new instance of the UriBuilder class with the specified Uri instance. Supports both absolute and relative URIs.
public UriBuilder(System.Uri uri);Parameters
uri System.Uri
The Uri instance to use as the base of the UriBuilder.
Properties
UriBuilder.Fragment Property
ParametersBuilder for the fragment part of the URI. Used for OAuth/OIDC implicit flow where parameters are passed in fragments.
public Abblix.Utils.ParametersBuilder Fragment { get; }Property Value
UriBuilder.Path Property
The path part of the URI.
public string Path { get; set; }Property Value
Remarks
Typed as a plain string rather than the framework's PathString: this is a foundation library, and that type would put an ASP.NET Core dependency on every package beneath the server, including hosts that never serve HTTP. A caller holding a PathString still assigns and reads it, since that type converts to and from string implicitly.
UriBuilder.Query Property
ParametersBuilder for the query string.
public Abblix.Utils.ParametersBuilder Query { get; }Property Value
UriBuilder.Uri Property
The URI constructed by the UriBuilder. For relative URIs, returns the path, query, and fragment without scheme and host.
public System.Uri Uri { get; }Property Value
Remarks
Note: This property has side effects (updates internal builder state) and is not thread-safe. If thread safety is required, synchronize access to this instance externally.
Operators
UriBuilder.implicit operator string(UriBuilder) Operator
Converts a UriBuilder instance to a string.
public static string implicit operator string(Abblix.Utils.UriBuilder builder);Parameters
builder UriBuilder
The UriBuilder instance to convert.
Returns
UriBuilder.implicit operator Uri(UriBuilder) Operator
Converts a UriBuilder instance to a Uri.
public static System.Uri implicit operator System.Uri(Abblix.Utils.UriBuilder builder);Parameters
builder UriBuilder
The UriBuilder instance to convert.