Class UrlGeneratorOptionsExtensions
Extension methods for UrlGeneratorOptions
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 |
---|---|---|
UrlGeneratorOptions | options | The options container that is extended |
Returns
Type | Description |
---|---|
ContextMode | 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 |
---|---|---|
UrlGeneratorOptions | options | The options container that is extended |
Returns
Type | Description |
---|---|
System.String | 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 |
---|---|---|
UrlGeneratorOptions | options | The options container that is extended |
Returns
Type | Description |
---|---|
System.Boolean | 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 |
---|---|---|
UrlGeneratorOptions | options | The options container that is extended |
Returns
Type | Description |
---|---|
System.Boolean | 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 |
---|---|---|
UrlGeneratorOptions | options | The options container that is extended |
Returns
Type | Description |
---|---|
System.Globalization.CultureInfo | 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 |
---|---|---|
UrlGeneratorOptions | options | The options container that is extended |
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | 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 |
---|---|---|
UrlGeneratorOptions | options | The options container that is extended |
ContextMode | mode | The context mode to set |
Returns
Type | Description |
---|---|
UrlGeneratorOptions | 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 |
---|---|---|
UrlGeneratorOptions | options | The options container that is extended |
System.String | host | The host to set |
Returns
Type | Description |
---|---|
UrlGeneratorOptions | 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 |
---|---|---|
UrlGeneratorOptions | options | The options container that is extended |
System.Boolean | value | The value to set |
Returns
Type | Description |
---|---|
UrlGeneratorOptions | 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 SetCurrentHost for rendering outside a web request)
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 |
---|---|---|
UrlGeneratorOptions | options | The options container that is extended |
System.Boolean | value | Specifies if the url should be generated as a canonical url |
Returns
Type | Description |
---|---|
UrlGeneratorOptions | 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 |
---|---|---|
UrlGeneratorOptions | options | The options container that is extended |
System.Globalization.CultureInfo | language | The language to set |
Returns
Type | Description |
---|---|
UrlGeneratorOptions | 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 |
---|---|---|
UrlGeneratorOptions | options | The options container that is extended |
System.Collections.Generic.IDictionary<System.String, System.Object> | routeValues | The route values to add |
Returns
Type | Description |
---|---|
UrlGeneratorOptions | The options container |