UrlHelperExtensions Class

Namespace
Microsoft.AspNetCore.Mvc
Assemblies
  • Microsoft.AspNetCore.Mvc.Core

Syntax

public class UrlHelperExtensions
class Microsoft.AspNetCore.Mvc.UrlHelperExtensions

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:
Return type:

System.String

Returns:

The fully qualified or absolute URL to an action method.

public static string Action(this IUrlHelper helper, string action)
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:
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)
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:
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)
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:
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)
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)
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)
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)
RouteUrl(Microsoft.AspNetCore.Mvc.IUrlHelper, System.Object)

Generates a fully qualified or absolute URL for the specified route values.

Arguments:
Return type:

System.String

Returns:

The fully qualified or absolute URL.

public static string RouteUrl(this IUrlHelper helper, object values)
RouteUrl(Microsoft.AspNetCore.Mvc.IUrlHelper, System.String)

Generates a fully qualified or absolute URL for the specified route name.

Arguments:
Return type:

System.String

Returns:

The fully qualified or absolute URL.

public static string RouteUrl(this IUrlHelper helper, string routeName)
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:
Return type:

System.String

Returns:

The fully qualified or absolute URL.

public static string RouteUrl(this IUrlHelper helper, string routeName, object values)
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:
Return type:

System.String

Returns:

The fully qualified or absolute URL.

public static string RouteUrl(this IUrlHelper helper, string routeName, object values, string protocol)
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)
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)