Interface IUrlResolver

Component that routes an url to the corresponding IContent instance or vice versa.

Namespace: EPiServer.Web.Routing
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
public interface IUrlResolver

Methods

GetUrl(ContentReference, String, UrlResolverArguments)

Gets the URL for a IContent instance that is given by argument urlResolverArguments.

Declaration
string GetUrl(ContentReference contentLink, string language, UrlResolverArguments urlResolverArguments)
Parameters
Type Name Description
ContentReference contentLink

The content link.

System.String language

The language.

UrlResolverArguments urlResolverArguments

The arguments used at url resolving

Returns
Type Description
System.String

A string representing the URL or null if it was not possible to create a route to the content

Remarks

The returned url can be relative or absolute (including host) depending on if the contentLink is on current site and current request matches host that matches content and language.

GetUrl(UrlBuilder, UrlResolverArguments)

Resolves the URL for an item from an URL with internal format.

Declaration
string GetUrl(UrlBuilder urlBuilderWithInternalUrl, UrlResolverArguments arguments)
Parameters
Type Name Description
UrlBuilder urlBuilderWithInternalUrl

The URL with a internal format.

UrlResolverArguments arguments

The UrlResolverArguments that determines the format of the link.

Returns
Type Description
System.String

A URL in string representation.

Remarks

The returned url can be relative or absolute (including host) depending on if the urlBuilderWithInternalUrl is on current site and current request matches host that matches content and language.

Route(UrlBuilder, ContextMode)

Routes the URL to the corresponding IContent instance.

Declaration
IContent Route(UrlBuilder urlBuilder, ContextMode contextMode)
Parameters
Type Name Description
UrlBuilder urlBuilder

The URL builder.

ContextMode contextMode

The ContextMode

Returns
Type Description
IContent

TryToPermanent(String, out String)

Tries to convert a URL with either a public, preview or permanent format to a permanent URL.

Declaration
bool TryToPermanent(string url, out string permanentUrl)
Parameters
Type Name Description
System.String url

The URL.

System.String permanentUrl

The permanent URL.

Returns
Type Description
System.Boolean

True if the conversion succeded, otherwise; false.

Extension Methods