Class UriUtilityCore
Provides utility methods for working with URIs.
Inheritance
object
Namespace: Umbraco.Cms.Core
Assembly: Umbraco.Core.dll
Syntax
public static class UriUtilityCore
Methods
View SourceEndPathWithSlash(string)
Ensures the path portion of the URI ends with a slash.
Declaration
public static string EndPathWithSlash(string uri)
Parameters
| Type | Name | Description |
|---|---|---|
| string | uri | The URI string. |
Returns
| Type | Description |
|---|---|
| string | The URI string with the path ending in a slash. |
HasScheme(string)
Determines whether the specified URI string contains a scheme (e.g., "http://").
Declaration
public static bool HasScheme(string uri)
Parameters
| Type | Name | Description |
|---|---|---|
| string | uri | The URI string to check. |
Returns
| Type | Description |
|---|---|
| bool |
|
StartWithScheme(string)
Ensures the URI string starts with a scheme, using HTTP as the default.
Declaration
public static string StartWithScheme(string uri)
Parameters
| Type | Name | Description |
|---|---|---|
| string | uri | The URI string. |
Returns
| Type | Description |
|---|---|
| string | The URI string with a scheme prefix. |
StartWithScheme(string, string?)
Ensures the URI string starts with the specified scheme.
Declaration
public static string StartWithScheme(string uri, string? scheme)
Parameters
| Type | Name | Description |
|---|---|---|
| string | uri | The URI string. |
| string | scheme | The scheme to use, or null to use HTTP. |
Returns
| Type | Description |
|---|---|
| string | The URI string with a scheme prefix. |
TrimPathEndSlash(string)
Removes the trailing slash from the path portion of the URI.
Declaration
public static string TrimPathEndSlash(string uri)
Parameters
| Type | Name | Description |
|---|---|---|
| string | uri | The URI string. |
Returns
| Type | Description |
|---|---|
| string | The URI string with the trailing slash removed from the path. |