Class UrlGeneratorOptionsExtensions
Extension methods for Url
Inheritance
Namespace: EPiServer.Core.Routing.Internal
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public static class UrlGeneratorOptionsExtensions : Object
Methods
GetContextMode(UrlGeneratorOptions)
Gets a context mode option that determines the format of the generated link
Declaration
public static ContextMode GetContextMode(this UrlGeneratorOptions options)
Parameters
Type | Name | Description |
---|---|---|
Url |
options | The options container that is extended |
Returns
Type | Description |
---|---|
Context |
The context mode option or null if it does not exist |
GetCurrentHost(UrlGeneratorOptions)
Gets the host option that will be used as current host, used for example for generating relative URL's
Declaration
public static string GetCurrentHost(this UrlGeneratorOptions options)
Parameters
Type | Name | Description |
---|---|---|
Url |
options | The options container that is extended |
Returns
Type | Description |
---|---|
System. |
The host option or null if it does not exist |
Remarks
This option overrides any automatic detection of the current host.
GetForceAbsoluteUrl(UrlGeneratorOptions)
Gets an option that forces absolute URLs
Declaration
public static bool GetForceAbsoluteUrl(this UrlGeneratorOptions options)
Parameters
Type | Name | Description |
---|---|---|
Url |
options | The options container that is extended |
Returns
Type | Description |
---|---|
System. |
The value or false if not specified |
GetForceCanonicalUrl(UrlGeneratorOptions)
Gets an option that forces absolute URLs
Declaration
public static bool GetForceCanonicalUrl(this UrlGeneratorOptions options)
Parameters
Type | Name | Description |
---|---|---|
Url |
options | The options container that is extended |
Returns
Type | Description |
---|---|
System. |
The value or |
GetLanguage(UrlGeneratorOptions)
Sets the language option that will determine the language of the link to generate
Declaration
public static CultureInfo GetLanguage(this UrlGeneratorOptions options)
Parameters
Type | Name | Description |
---|---|---|
Url |
options | The options container that is extended |
Returns
Type | Description |
---|---|
System. |
The language option or null if it does not exist |
GetRouteValues(UrlGeneratorOptions)
Gets an option that forces absolute URLs
Declaration
public static IDictionary<string, object> GetRouteValues(this UrlGeneratorOptions options)
Parameters
Type | Name | Description |
---|---|---|
Url |
options | The options container that is extended |
Returns
Type | Description |
---|---|
System. |
The value or |
SetContextMode(UrlGeneratorOptions, ContextMode)
Sets a context mode option that determines the format of the generated link
Declaration
public static UrlGeneratorOptions SetContextMode(this UrlGeneratorOptions options, ContextMode mode)
Parameters
Type | Name | Description |
---|---|---|
Url |
options | The options container that is extended |
Context |
mode | The context mode to set |
Returns
Type | Description |
---|---|
Url |
The options container |
SetCurrentHost(UrlGeneratorOptions, String)
Sets a host option that will be used as "current host", used for example for generating relative URL's
Declaration
public static UrlGeneratorOptions SetCurrentHost(this UrlGeneratorOptions options, string host)
Parameters
Type | Name | Description |
---|---|---|
Url |
options | The options container that is extended |
System. |
host | The host to set |
Returns
Type | Description |
---|---|
Url |
The options container |
Remarks
This option overrides any automatic detection of the current host.
SetForceAbsoluteUrl(UrlGeneratorOptions, Boolean)
Sets an option that forces absolute URLs
Declaration
public static UrlGeneratorOptions SetForceAbsoluteUrl(this UrlGeneratorOptions options, bool value = true)
Parameters
Type | Name | Description |
---|---|---|
Url |
options | The options container that is extended |
System. |
value | The value to set |
Returns
Type | Description |
---|---|
Url |
The options container |
Remarks
It is not possible to generate absolute URL's for content outside a site unless there is a current host (use Set
SetForceCanonicalUrl(UrlGeneratorOptions, Boolean)
Sets an option that forces the use of the canonical URL
Declaration
public static UrlGeneratorOptions SetForceCanonicalUrl(this UrlGeneratorOptions options, bool value = true)
Parameters
Type | Name | Description |
---|---|---|
Url |
options | The options container that is extended |
System. |
value | Specifies if the url should be generated as a canonical url |
Returns
Type | Description |
---|---|
Url |
The options container |
SetLanguage(UrlGeneratorOptions, CultureInfo)
Sets a language option that will determine the language of the link to generate
Declaration
public static UrlGeneratorOptions SetLanguage(this UrlGeneratorOptions options, CultureInfo language)
Parameters
Type | Name | Description |
---|---|---|
Url |
options | The options container that is extended |
System. |
language | The language to set |
Returns
Type | Description |
---|---|
Url |
The options container |
SetRouteValues(UrlGeneratorOptions, IDictionary<String, Object>)
Adds route values to the options for url generation
Declaration
public static UrlGeneratorOptions SetRouteValues(this UrlGeneratorOptions options, IDictionary<string, object> routeValues)
Parameters
Type | Name | Description |
---|---|---|
Url |
options | The options container that is extended |
System. |
routeValues | The route values to add |
Returns
Type | Description |
---|---|
Url |
The options container |