Class UrlProvider
Provides urls.
Inheritance
Namespace:System.Dynamic.ExpandoObject
Assembly:umbraco.dll
Syntax
public class UrlProvider
Constructors
UrlProvider(UmbracoContext, IEnumerable<IUrlProvider>, UrlProviderMode)
Initializes a new instance of the UrlProvider class with an Umbraco context and a list of url providers.
Declaration
public UrlProvider(UmbracoContext umbracoContext, IEnumerable<IUrlProvider> urlProviders, UrlProviderMode provider = UrlProviderMode.Auto)
Parameters
Type | Name | Description |
---|---|---|
UmbracoContext | umbracoContext | The Umbraco context. |
System.Collections.Generic.IEnumerable<IUrlProvider> | urlProviders | The list of url providers. |
UrlProviderMode | provider |
UrlProvider(UmbracoContext, IWebRoutingSection, IEnumerable<IUrlProvider>)
Initializes a new instance of the UrlProvider class with an Umbraco context and a list of url providers.
Declaration
public UrlProvider(UmbracoContext umbracoContext, IWebRoutingSection routingSettings, IEnumerable<IUrlProvider> urlProviders)
Parameters
Type | Name | Description |
---|---|---|
UmbracoContext | umbracoContext | The Umbraco context. |
IWebRoutingSection | routingSettings | |
System.Collections.Generic.IEnumerable<IUrlProvider> | urlProviders | The list of url providers. |
Properties
Mode
Gets or sets the provider url mode.
Declaration
public UrlProviderMode Mode { get; set; }
Property Value
Type | Description |
---|---|
UrlProviderMode |
Methods
GetOtherUrls(Int32)
Gets the other urls of a published content.
Declaration
public IEnumerable<string> GetOtherUrls(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The published content id. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | The other urls for the published content. |
Remarks
Other urls are those that GetUrl
would not return in the current context, but would be valid
urls for the node in other contexts (different domain for current request, umbracoUrlAlias...).
The results depend on the current url.
GetOtherUrls(Int32, Uri)
Gets the other urls of a published content.
Declaration
public IEnumerable<string> GetOtherUrls(int id, Uri current)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The published content id. |
System.Uri | current | The current absolute url. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | The other urls for the published content. |
Remarks
Other urls are those that GetUrl
would not return in the current context, but would be valid
urls for the node in other contexts (different domain for current request, umbracoUrlAlias...).
GetUrl(Guid)
Gets the url of a published content.
Declaration
public string GetUrl(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The published content identifier. |
Returns
Type | Description |
---|---|
System.String | The url for the published content. |
Remarks
The url is absolute or relative depending on Mode
and on the current url.
If the provider is unable to provide a url, it returns "#".
GetUrl(Guid, Boolean)
Gets the nice url of a published content.
Declaration
public string GetUrl(Guid id, bool absolute)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The published content identifier. |
System.Boolean | absolute | A value indicating whether the url should be absolute in any case. |
Returns
Type | Description |
---|---|
System.String | The url for the published content. |
Remarks
The url is absolute or relative depending on Mode
and on current
, unless
absolute
is true, in which case the url is always absolute.
If the provider is unable to provide a url, it returns "#".
GetUrl(Guid, Uri, Boolean)
Gets the nice url of a published content.
Declaration
public string GetUrl(Guid id, Uri current, bool absolute)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The published content id. |
System.Uri | current | The current absolute url. |
System.Boolean | absolute | A value indicating whether the url should be absolute in any case. |
Returns
Type | Description |
---|---|
System.String | The url for the published content. |
Remarks
The url is absolute or relative depending on Mode
and on current
, unless
absolute
is true, in which case the url is always absolute.
If the provider is unable to provide a url, it returns "#".
GetUrl(Guid, UrlProviderMode)
Gets the nice url of a published content.
Declaration
public string GetUrl(Guid id, UrlProviderMode mode)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The published content identifier. |
UrlProviderMode | mode | The url mode. |
Returns
Type | Description |
---|---|
System.String | The url for the published content. |
Remarks
The url is absolute or relative depending on mode
and on the current url.
If the provider is unable to provide a url, it returns "#".
GetUrl(Int32)
Gets the url of a published content.
Declaration
public string GetUrl(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The published content identifier. |
Returns
Type | Description |
---|---|
System.String | The url for the published content. |
Remarks
The url is absolute or relative depending on Mode
and on the current url.
If the provider is unable to provide a url, it returns "#".
GetUrl(Int32, Boolean)
Gets the nice url of a published content.
Declaration
public string GetUrl(int id, bool absolute)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The published content identifier. |
System.Boolean | absolute | A value indicating whether the url should be absolute in any case. |
Returns
Type | Description |
---|---|
System.String | The url for the published content. |
Remarks
The url is absolute or relative depending on Mode
and on current
, unless
absolute
is true, in which case the url is always absolute.
If the provider is unable to provide a url, it returns "#".
GetUrl(Int32, Uri, Boolean)
Gets the nice url of a published content.
Declaration
public string GetUrl(int id, Uri current, bool absolute)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The published content id. |
System.Uri | current | The current absolute url. |
System.Boolean | absolute | A value indicating whether the url should be absolute in any case. |
Returns
Type | Description |
---|---|
System.String | The url for the published content. |
Remarks
The url is absolute or relative depending on Mode
and on current
, unless
absolute
is true, in which case the url is always absolute.
If the provider is unable to provide a url, it returns "#".
GetUrl(Int32, Uri, UrlProviderMode)
Gets the nice url of a published content.
Declaration
public string GetUrl(int id, Uri current, UrlProviderMode mode)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The published content id. |
System.Uri | current | The current absolute url. |
UrlProviderMode | mode | The url mode. |
Returns
Type | Description |
---|---|
System.String | The url for the published content. |
Remarks
The url is absolute or relative depending on mode
and on current
.
If the provider is unable to provide a url, it returns "#".
GetUrl(Int32, UrlProviderMode)
Gets the nice url of a published content.
Declaration
public string GetUrl(int id, UrlProviderMode mode)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The published content identifier. |
UrlProviderMode | mode | The url mode. |
Returns
Type | Description |
---|---|
System.String | The url for the published content. |
Remarks
The url is absolute or relative depending on mode
and on the current url.
If the provider is unable to provide a url, it returns "#".