UrlHelperExtensions Class¶
- Namespace
Microsoft.AspNetCore.Mvc
- Assemblies
- Microsoft.AspNetCore.Mvc.Core
Methods¶
-
Action
(Microsoft.AspNetCore.Mvc.IUrlHelper)¶ Generates a fully qualified or absolute URL for an action method.
Return type: System.String Returns: The fully qualified or absolute URL to an action method. public static string Action(this IUrlHelper helper)
-
Action
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String) Generates a fully qualified or absolute URL for an action method by using the specified action name.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - action (System.String) – The name of the action method.
Return type: System.String
Returns: The fully qualified or absolute URL to an action method.
public static string Action(this IUrlHelper helper, string action)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-
Action
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String, System.Object) Generates a fully qualified or absolute URL for an action method by using the specified action name, and route values.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - action (System.String) – The name of the action method.
- values (System.Object) – An object that contains route values.
Return type: System.String
Returns: The fully qualified or absolute URL to an action method.
public static string Action(this IUrlHelper helper, string action, object values)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-
Action
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String, System.String) Generates a fully qualified or absolute URL for an action method by using the specified action name, and controller name.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - action (System.String) – The name of the action method.
- controller (System.String) – The name of the controller.
Return type: System.String
Returns: The fully qualified or absolute URL to an action method.
public static string Action(this IUrlHelper helper, string action, string controller)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-
Action
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String, System.String, System.Object) Generates a fully qualified or absolute URL for an action method by using the specified action name, controller name, and route values.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - action (System.String) – The name of the action method.
- controller (System.String) – The name of the controller.
- values (System.Object) – An object that contains route values.
Return type: System.String
Returns: The fully qualified or absolute URL to an action method.
public static string Action(this IUrlHelper helper, string action, string controller, object values)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-
Action
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String, System.String, System.Object, System.String) Generates a fully qualified or absolute URL for an action method by using the specified action name, controller name, route values, and protocol to use.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - action (System.String) – The name of the action method.
- controller (System.String) – The name of the controller.
- values (System.Object) – An object that contains route values.
- protocol (System.String) – The protocol for the URL, such as “http” or “https”.
Return type: System.String
Returns: The fully qualified or absolute URL to an action method.
public static string Action(this IUrlHelper helper, string action, string controller, object values, string protocol)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-
Action
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String, System.String, System.Object, System.String, System.String) Generates a fully qualified or absolute URL for an action method by using the specified action name, controller name, route values, protocol to use, and host name.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - action (System.String) – The name of the action method.
- controller (System.String) – The name of the controller.
- values (System.Object) – An object that contains route values.
- protocol (System.String) – The protocol for the URL, such as “http” or “https”.
- host (System.String) – The host name for the URL.
Return type: System.String
Returns: The fully qualified or absolute URL to an action method.
public static string Action(this IUrlHelper helper, string action, string controller, object values, string protocol, string host)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-
Action
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String, System.String, System.Object, System.String, System.String, System.String) Generates a fully qualified or absolute URL for an action method by using the specified action name, controller name, route values, protocol to use, host name and fragment.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - action (System.String) – The name of the action method.
- controller (System.String) – The name of the controller.
- values (System.Object) – An object that contains route values.
- protocol (System.String) – The protocol for the URL, such as “http” or “https”.
- host (System.String) – The host name for the URL.
- fragment (System.String) – The fragment for the URL.
Return type: System.String
Returns: The fully qualified or absolute URL to an action method.
public static string Action(this IUrlHelper helper, string action, string controller, object values, string protocol, string host, string fragment)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-
RouteUrl
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.Object)¶ Generates a fully qualified or absolute URL for the specified route values.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - values (System.Object) – An object that contains route values.
Return type: System.String
Returns: The fully qualified or absolute URL.
public static string RouteUrl(this IUrlHelper helper, object values)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-
RouteUrl
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String) Generates a fully qualified or absolute URL for the specified route name.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - routeName (System.String) – The name of the route that is used to generate URL.
Return type: System.String
Returns: The fully qualified or absolute URL.
public static string RouteUrl(this IUrlHelper helper, string routeName)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-
RouteUrl
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String, System.Object) Generates a fully qualified or absolute URL for the specified route values by using the specified route name.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - routeName (System.String) – The name of the route that is used to generate URL.
- values (System.Object) – An object that contains route values.
Return type: System.String
Returns: The fully qualified or absolute URL.
public static string RouteUrl(this IUrlHelper helper, string routeName, object values)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-
RouteUrl
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String, System.Object, System.String) Generates a fully qualified or absolute URL for the specified route values by using the specified route name, and protocol to use.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - routeName (System.String) – The name of the route that is used to generate URL.
- values (System.Object) – An object that contains route values.
- protocol (System.String) – The protocol for the URL, such as “http” or “https”.
Return type: System.String
Returns: The fully qualified or absolute URL.
public static string RouteUrl(this IUrlHelper helper, string routeName, object values, string protocol)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-
RouteUrl
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String, System.Object, System.String, System.String) Generates a fully qualified or absolute URL for the specified route values by using the specified route name, protocol to use, and host name.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - routeName (System.String) – The name of the route that is used to generate URL.
- values (System.Object) – An object that contains route values.
- protocol (System.String) – The protocol for the URL, such as “http” or “https”.
- host (System.String) – The host name for the URL.
Return type: System.String
Returns: The fully qualified or absolute URL.
public static string RouteUrl(this IUrlHelper helper, string routeName, object values, string protocol, string host)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-
RouteUrl
(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String, System.Object, System.String, System.String, System.String) Generates a fully qualified or absolute URL for the specified route values by using the specified route name, protocol to use, host name and fragment.
Arguments: - helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
Microsoft.AspNetCore.Mvc.IUrlHelper
. - routeName (System.String) – The name of the route that is used to generate URL.
- values (System.Object) – An object that contains route values.
- protocol (System.String) – The protocol for the URL, such as “http” or “https”.
- host (System.String) – The host name for the URL.
- fragment (System.String) – The fragment for the URL.
Return type: System.String
Returns: The fully qualified or absolute URL.
public static string RouteUrl(this IUrlHelper helper, string routeName, object values, string protocol, string host, string fragment)
- helper (Microsoft.AspNetCore.Mvc.IUrlHelper) – The
-