Flurl
Fluent URL-building extension methods on String and Uri.
Creates a new Url object from the string and appends a segment to the URL path, ensuring there is one and only one '/' character as a separator.
This URL.
The segment to append
If true, URL-encodes reserved characters such as '/', '+', and '%'. Otherwise, only encodes strictly illegal characters (including '%' but only when not followed by 2 hex characters).
A new Flurl.Url object.
Appends multiple segments to the URL path, ensuring there is one and only one '/' character as a separator.
This URL.
The segments to append
A new Flurl.Url object.
Appends multiple segments to the URL path, ensuring there is one and only one '/' character as a separator.
This URL.
The segments to append
A new Flurl.Url object.
Removes the last path segment from the URL.
This URL.
A new Flurl.Url object.
Removes the entire path component of the URL.
This URL.
A new Flurl.Url object.
Creates a new Url object from the string and adds a parameter to the query, overwriting the value if name exists.
This URL.
Name of query parameter
Value of query parameter
Indicates how to handle null values. Defaults to Remove (any existing)
A new Flurl.Url object.
Creates a new Url object from the string and adds a parameter to the query, overwriting the value if name exists.
This URL.
Name of query parameter
Value of query parameter
Set to true to indicate the value is already URL-encoded. Defaults to false.
Indicates how to handle null values. Defaults to Remove (any existing).
A new Flurl.Url object.
Creates a new Url object from the string and adds a parameter without a value to the query, removing any existing value.
This URL.
Name of query parameter
A new Flurl.Url object.
Creates a new Url object from the string, parses values object into name/value pairs, and adds them to the query, overwriting any that already exist.
This URL.
Typically an anonymous object, ie: new { x = 1, y = 2 }
Indicates how to handle null values. Defaults to Remove (any existing)
A new Flurl.Url object.
Creates a new Url object from the string and adds multiple parameters without values to the query.
This URL.
Names of query parameters.
A new Flurl.Url object.
Creates a new Url object from the string and adds multiple parameters without values to the query.
This URL.
Names of query parameters
A new Flurl.Url object.
Creates a new Url object from the string and removes a name/value pair from the query by name.
This URL.
Query string parameter name to remove
A new Flurl.Url object.
Creates a new Url object from the string and removes multiple name/value pairs from the query by name.
This URL.
Query string parameter names to remove
A new Flurl.Url object.
Creates a new Url object from the string and removes multiple name/value pairs from the query by name.
This URL.
Query string parameter names to remove
A new Flurl.Url object.
Removes the entire query component of the URL.
This URL.
A new Flurl.Url object.
Set the URL fragment fluently.
This URL.
The part of the URL after #
A new Flurl.Url object.
Removes the URL fragment including the #.
This URL.
A new Flurl.Url object.
Trims the URL to its root, including the scheme, any user info, host, and port (if specified).
This URL.
A new Flurl.Url object.
Creates a new Url object from the string and appends a segment to the URL path, ensuring there is one and only one '/' character as a separator.
This System.Uri.
The segment to append
If true, URL-encodes reserved characters such as '/', '+', and '%'. Otherwise, only encodes strictly illegal characters (including '%' but only when not followed by 2 hex characters).
A new Flurl.Url object.
Appends multiple segments to the URL path, ensuring there is one and only one '/' character as a separator.
This System.Uri.
The segments to append
A new Flurl.Url object.
Appends multiple segments to the URL path, ensuring there is one and only one '/' character as a separator.
This System.Uri.
The segments to append
A new Flurl.Url object.
Removes the last path segment from the URL.
This System.Uri.
A new Flurl.Url object.
Removes the entire path component of the URL.
This System.Uri.
A new Flurl.Url object.
Creates a new Url object from the string and adds a parameter to the query, overwriting the value if name exists.
This System.Uri.
Name of query parameter
Value of query parameter
Indicates how to handle null values. Defaults to Remove (any existing)
A new Flurl.Url object.
Creates a new Url object from the string and adds a parameter to the query, overwriting the value if name exists.
This System.Uri.
Name of query parameter
Value of query parameter
Set to true to indicate the value is already URL-encoded. Defaults to false.
Indicates how to handle null values. Defaults to Remove (any existing).
A new Flurl.Url object.
Creates a new Url object from the string and adds a parameter without a value to the query, removing any existing value.
This System.Uri.
Name of query parameter
A new Flurl.Url object.
Creates a new Url object from the string, parses values object into name/value pairs, and adds them to the query, overwriting any that already exist.
This System.Uri.
Typically an anonymous object, ie: new { x = 1, y = 2 }
Indicates how to handle null values. Defaults to Remove (any existing)
A new Flurl.Url object.
Creates a new Url object from the string and adds multiple parameters without values to the query.
This System.Uri.
Names of query parameters.
A new Flurl.Url object.
Creates a new Url object from the string and adds multiple parameters without values to the query.
This System.Uri.
Names of query parameters
A new Flurl.Url object.
Creates a new Url object from the string and removes a name/value pair from the query by name.
This System.Uri.
Query string parameter name to remove
A new Flurl.Url object.
Creates a new Url object from the string and removes multiple name/value pairs from the query by name.
This System.Uri.
Query string parameter names to remove
A new Flurl.Url object.
Creates a new Url object from the string and removes multiple name/value pairs from the query by name.
This System.Uri.
Query string parameter names to remove
A new Flurl.Url object.
Removes the entire query component of the URL.
This System.Uri.
A new Flurl.Url object.
Set the URL fragment fluently.
This System.Uri.
The part of the URL after #
A new Flurl.Url object.
Removes the URL fragment including the #.
This System.Uri.
A new Flurl.Url object.
Trims the URL to its root, including the scheme, any user info, host, and port (if specified).
This System.Uri.
A new Flurl.Url object.
Describes how to handle null values in query parameters.
Set as name without value in query string.
Don't add to query string, remove any existing value.
Don't add to query string, but leave any existing value unchanged.
Represents a URL query as a collection of name/value pairs. Insertion order is preserved.
Returns a new instance of QueryParamCollection
Optional query string to parse.
Returns serialized, encoded query string. Insertion order is preserved.
Returns serialized, encoded query string. Insertion order is preserved.
Appends a query parameter. If value is a collection type (array, IEnumerable, etc.), multiple parameters are added, i.e. x=1&x=2.
To overwrite existing parameters of the same name, use AddOrReplace instead.
Name of the parameter.
Value of the parameter. If it's a collection, multiple parameters of the same name are added.
If true, assume value(s) already URL-encoded.
Describes how to handle null values.
Replaces existing query parameter(s) or appends to the end. If value is a collection type (array, IEnumerable, etc.),
multiple parameters are added, i.e. x=1&x=2. If any of the same name already exist, they are overwritten one by one
(preserving order) and any remaining are appended to the end. If fewer values are specified than already exist,
remaining existing values are removed.
Name of the parameter.
Value of the parameter. If it's a collection, multiple parameters of the same name are added/replaced.
If true, assume value(s) already URL-encoded.
Describes how to handle null values.
Removes all query parameters of the given name.
Clears all query parameters from this collection.
>
>
>
>
>
>
>
>
Represents a query parameter value with the ability to track whether it was already encoded when created.
A mutable object for fluently building and parsing URLs.
The scheme of the URL, i.e. "http". Does not include ":" delimiter. Empty string if the URL is relative.
i.e. "user:pass" in "https://user:pass@www.site.com". Empty string if not present.
i.e. "www.site.com" in "https://www.site.com:8080/path". Does not include user info or port.
Port number of the URL. Null if not explicitly specified.
i.e. "www.site.com:8080" in "https://www.site.com:8080/path". Includes both user info and port, if included.
i.e. "https://www.site.com:8080" in "https://www.site.com:8080/path" (everything before the path).
i.e. "/path" in "https://www.site.com/path". Empty string if not present. Leading and trailing "/" retained exactly as specified by user.
The "/"-delimited segments of the path, not including leading or trailing "/" characters.
i.e. "x=1&y=2" in "https://www.site.com/path?x=1&y=2". Does not include "?".
Query parsed to name/value pairs.
i.e. "frag" in "https://www.site.com/path?x=y#frag". Does not include "#".
True if URL does not start with a non-empty scheme. i.e. true for "https://www.site.com", false for "//www.site.com".
True if Url is absolute and scheme is https or wss.
Constructs a Url object from a string.
The URL to use as a starting point.
Constructs a Url object from a System.Uri.
The System.Uri (required)
is .
Parses a URL string into a Flurl.Url object.
Parses a URL query to a QueryParamCollection.
The URL query to parse.
Splits the given path into segments, encoding illegal characters, "?", and "#".
The path to split.
Appends a segment to the URL path, ensuring there is one and only one '/' character as a separator.
The segment to append
If true, URL-encodes reserved characters such as '/', '+', and '%'. Otherwise, only encodes strictly illegal characters (including '%' but only when not followed by 2 hex characters).
the Url object with the segment appended
is .
Appends multiple segments to the URL path, ensuring there is one and only one '/' character as a seperator.
The segments to append
the Url object with the segments appended
Appends multiple segments to the URL path, ensuring there is one and only one '/' character as a seperator.
The segments to append
the Url object with the segments appended
Removes the last path segment from the URL.
The Url object.
Removes the entire path component of the URL, including the leading slash.
The Url object.
Adds a parameter to the query, overwriting the value if name exists.
Name of query parameter
Value of query parameter
Indicates how to handle null values. Defaults to Remove (any existing)
The Url object with the query parameter added
Adds a parameter to the query, overwriting the value if name exists.
Name of query parameter
Value of query parameter
Set to true to indicate the value is already URL-encoded
Indicates how to handle null values. Defaults to Remove (any existing)
The Url object with the query parameter added
is .
Adds a parameter without a value to the query, removing any existing value.
Name of query parameter
The Url object with the query parameter added
Parses values (usually an anonymous object or dictionary) into name/value pairs and adds them to the query, overwriting any that already exist.
Typically an anonymous object, ie: new { x = 1, y = 2 }
Indicates how to handle null values. Defaults to Remove (any existing)
The Url object with the query parameters added
Adds multiple parameters without values to the query.
Names of query parameters.
The Url object with the query parameter added
Adds multiple parameters without values to the query.
Names of query parameters
The Url object with the query parameter added.
Removes a name/value pair from the query by name.
Query string parameter name to remove
The Url object with the query parameter removed
Removes multiple name/value pairs from the query by name.
Query string parameter names to remove
The Url object.
Removes multiple name/value pairs from the query by name.
Query string parameter names to remove
The Url object with the query parameters removed
Removes the entire query component of the URL.
The Url object.
Set the URL fragment fluently.
The part of the URL after #
The Url object with the new fragment set
Removes the URL fragment including the #.
The Url object with the fragment removed
Resets the URL to its root, including the scheme, any user info, host, and port (if specified).
The Url object trimmed to its root.
Resets the URL to its original state as set in the constructor.
Creates a copy of this Url.
Converts this Url object to its string representation.
Indicates whether to encode spaces with the "+" character instead of "%20"
Converts this Url object to its string representation.
Converts this Url object to System.Uri
The System.Uri object
Implicit conversion from Url to String.
The Url object
The string
Implicit conversion from String to Url.
The String representation of the URL
The string
Implicit conversion from System.Uri to Flurl.Url.
The string
True if obj is an instance of Url and its string representation is equal to this instance's string representation.
The object to compare to this instance.
Returns the hashcode for this Url.
Basically a Path.Combine for URLs. Ensures exactly one '/' separates each segment,
and exactly on '&' separates each query parameter.
URL-encodes illegal characters but not reserved characters.
URL parts to combine.
Decodes a URL-encoded string.
The URL-encoded string.
If true, any '+' character will be decoded to a space.
URL-encodes a string, including reserved characters such as '/' and '?'.
The string to encode.
If true, spaces will be encoded as + signs. Otherwise, they'll be encoded as %20.
The encoded URL.
URL-encodes characters in a string that are neither reserved nor unreserved. Avoids encoding reserved characters such as '/' and '?'. Avoids encoding '%' if it begins a %-hex-hex sequence (i.e. avoids double-encoding).
The string to encode.
If true, spaces will be encoded as + signs. Otherwise, they'll be encoded as %20.
The encoded URL.
Checks if a string is a well-formed absolute URL.
The string to check
true if the string is a well-formed absolute URL
CommonExtensions for objects.
Returns a key-value-pairs representation of the object.
For strings, URL query string format assumed and pairs are parsed from that.
For objects that already implement IEnumerable<KeyValuePair>, the object itself is simply returned.
For all other objects, all publicly readable properties are extracted and returned as pairs.
The object to parse into key-value pairs
is .
Returns a string that represents the current object, using CultureInfo.InvariantCulture where possible.
Dates are represented in IS0 8601.
Splits at the first occurrence of the given separator.
The string to split.
The separator to split on.
Array of at most 2 strings. (1 if separator is not found.)
Merges the key/value pairs from d2 into d1, without overwriting those already set in d1.
Strips any single quotes or double quotes from the beginning and end of a string.
True if the given string is a valid IPv4 address.
Defines common methods for INameValueList and IReadOnlyNameValueList.
Returns the first Value of the given Name if one exists, otherwise null or default value.
Gets the first Value of the given Name, if one exists.
true if any item of the given name is found, otherwise false.
Gets all Values of the given Name.
True if any items with the given Name exist.
True if any item with the given Name and Value exists.
Defines an ordered collection of Name/Value pairs where duplicate names are allowed but aren't typical.
Adds a new Name/Value pair.
Replaces the first occurrence of the given Name with the given Value and removes any others,
or adds a new Name/Value pair if none exist.
Removes all items of the given Name.
true if any item of the given name is found, otherwise false.
Defines a read-only ordered collection of Name/Value pairs where duplicate names are allowed but aren't typical.
An ordered collection of Name/Value pairs where duplicate names are allowed but aren't typical.
Useful for things where a dictionary would work great if not for those pesky edge cases (headers, cookies, etc).
Instantiates a new empty NameValueList.
Instantiates a new NameValueList with the Name/Value pairs provided.