Class UrlInfo
Represents infos for a URL.
Inheritance
Namespace: Umbraco.Cms.Core.Routing
Assembly: Umbraco.Core.dll
Syntax
[DataContract(Name = "urlInfo", Namespace = "")]
public class UrlInfo
Constructors
View SourceUrlInfo(string, string, string?)
Initializes a new instance of the UrlInfo class as a "message only" - that is, not an actual URL.
Declaration
public UrlInfo(string message, string provider, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | |
| string | provider | |
| string | culture |
UrlInfo(Uri, string, string?, string?, bool)
Initializes a new instance of the UrlInfo class.
Declaration
public UrlInfo(Uri url, string provider, string? culture, string? message = null, bool isExternal = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | url | |
| string | provider | |
| string | culture | |
| string | message | |
| bool | isExternal |
Properties
View SourceCulture
Gets the culture.
Declaration
[DataMember(Name = "culture")]
public string? Culture { get; }
Property Value
| Type | Description |
|---|---|
| string |
IsExternal
Gets whether this is considered an external or a local URL (remote or local host).
Declaration
[DataMember(Name = "isExternal")]
public bool IsExternal { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Message
Gets the message.
Declaration
[DataMember(Name = "message")]
public string? Message { get; }
Property Value
| Type | Description |
|---|---|
| string |
Provider
Gets the name of the URL provider that generated this URL info.
Declaration
public string Provider { get; }
Property Value
| Type | Description |
|---|---|
| string |
Url
Gets the URL.
Declaration
[DataMember(Name = "url")]
public Uri? Url { get; }
Property Value
| Type | Description |
|---|---|
| Uri |
Methods
View SourceAsMessage(string, string, string?)
Creates a UrlInfo instance representing a message (not an actual URL).
Declaration
public static UrlInfo AsMessage(string message, string provider, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The message. |
| string | provider | The name of the URL provider. |
| string | culture | The optional culture. |
Returns
| Type | Description |
|---|---|
| UrlInfo | A new UrlInfo instance. |
AsUrl(string, string, string?, bool)
Creates a UrlInfo instance representing an actual URL.
Declaration
public static UrlInfo AsUrl(string url, string provider, string? culture = null, bool isExternal = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The URL string. |
| string | provider | The name of the URL provider. |
| string | culture | The optional culture. |
| bool | isExternal | A value indicating whether the URL is external. |
Returns
| Type | Description |
|---|---|
| UrlInfo | A new UrlInfo instance. |
Equals(object?)
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Equals(UrlInfo?)
Checks equality
Declaration
public bool Equals(UrlInfo? other)
Parameters
| Type | Name | Description |
|---|---|---|
| UrlInfo | other |
Returns
| Type | Description |
|---|---|
| bool |
FromUri(Uri, string, string?, bool)
Creates a UrlInfo instance from a System.Uri.
Declaration
public static UrlInfo FromUri(Uri uri, string provider, string? culture = null, bool isExternal = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | The URI. |
| string | provider | The name of the URL provider. |
| string | culture | The optional culture. |
| bool | isExternal | A value indicating whether the URL is external. |
Returns
| Type | Description |
|---|---|
| UrlInfo | A new UrlInfo instance. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Operators
View Sourceoperator ==(UrlInfo, UrlInfo)
Determines whether two specified UrlInfo objects have the same value.
Declaration
public static bool operator ==(UrlInfo left, UrlInfo right)
Parameters
| Type | Name | Description |
|---|---|---|
| UrlInfo | left | The first UrlInfo to compare. |
| UrlInfo | right | The second UrlInfo to compare. |
Returns
| Type | Description |
|---|---|
| bool |
|
operator !=(UrlInfo, UrlInfo)
Determines whether two specified UrlInfo objects have different values.
Declaration
public static bool operator !=(UrlInfo left, UrlInfo right)
Parameters
| Type | Name | Description |
|---|---|---|
| UrlInfo | left | The first UrlInfo to compare. |
| UrlInfo | right | The second UrlInfo to compare. |
Returns
| Type | Description |
|---|---|
| bool |
|