UrlHelper UrlHelper UrlHelper Class

Definition

An implementation of IUrlHelper that contains methods to build URLs for ASP.NET MVC within an application.

public class UrlHelper : Microsoft.AspNetCore.Mvc.Routing.UrlHelperBase
type UrlHelper = class
    inherit UrlHelperBase
Public Class UrlHelper
Inherits UrlHelperBase
Inheritance

Constructors

UrlHelper(ActionContext) UrlHelper(ActionContext) UrlHelper(ActionContext)

Initializes a new instance of the UrlHelper class using the specified actionContext.

Properties

ActionContext ActionContext ActionContext
AmbientValues AmbientValues AmbientValues

Gets the RouteValueDictionary associated with the current request.

HttpContext HttpContext HttpContext

Gets the HttpContext associated with the current request.

Router Router Router

Gets the top-level IRouter associated with the current request. Generally an IRouteCollection implementation.

Methods

Action(UrlActionContext) Action(UrlActionContext) Action(UrlActionContext)
Content(String) Content(String) Content(String)
GenerateUrl(String, String, String) GenerateUrl(String, String, String) GenerateUrl(String, String, String)

Generates a URI from the provided components.

(Inherited from UrlHelperBase)
GenerateUrl(String, String, String, String) GenerateUrl(String, String, String, String) GenerateUrl(String, String, String, String) Inherited from UrlHelperBase
GenerateUrl(String, String, VirtualPathData, String) GenerateUrl(String, String, VirtualPathData, String) GenerateUrl(String, String, VirtualPathData, String)

Generates the URL using the specified components.

GetValuesDictionary(Object) GetValuesDictionary(Object) GetValuesDictionary(Object) Inherited from UrlHelperBase
GetVirtualPathData(String, RouteValueDictionary) GetVirtualPathData(String, RouteValueDictionary) GetVirtualPathData(String, RouteValueDictionary)

Gets the VirtualPathData for the specified routeName and route values.

IsLocalUrl(String) IsLocalUrl(String) IsLocalUrl(String)
Link(String, Object) Link(String, Object) Link(String, Object)
RouteUrl(UrlRouteContext) RouteUrl(UrlRouteContext) RouteUrl(UrlRouteContext)

Extension Methods

Action(IUrlHelper) Action(IUrlHelper) Action(IUrlHelper)

Generates a URL with an absolute path for an action method.

Action(IUrlHelper, String) Action(IUrlHelper, String) Action(IUrlHelper, String)

Generates a URL with an absolute path for an action method, which contains the specified action name.

Action(IUrlHelper, String, Object) Action(IUrlHelper, String, Object) Action(IUrlHelper, String, Object)

Generates a URL with an absolute path for an action method, which contains the specified action name and route values.

Action(IUrlHelper, String, String) Action(IUrlHelper, String, String) Action(IUrlHelper, String, String)

Generates a URL with an absolute path for an action method, which contains the specified action and controller names.

Action(IUrlHelper, String, String, Object) Action(IUrlHelper, String, String, Object) Action(IUrlHelper, String, String, Object)

Generates a URL with an absolute path for an action method, which contains the specified action name, controller name, and route values.

Action(IUrlHelper, String, String, Object, String) Action(IUrlHelper, String, String, Object, String) Action(IUrlHelper, String, String, Object, String)

Generates a URL with an absolute path for an action method, which contains the specified action name, controller name, route values, and protocol to use. See the remarks section for important security information.

Action(IUrlHelper, String, String, Object, String, String) Action(IUrlHelper, String, String, Object, String, String) Action(IUrlHelper, String, String, Object, String, String)

Generates a URL with an absolute path for an action method, which contains the specified action name, controller name, route values, protocol to use, and host name. Generates an absolute URL if the protocol and host are non-null. See the remarks section for important security information.

Action(IUrlHelper, String, String, Object, String, String, String) Action(IUrlHelper, String, String, Object, String, String, String) Action(IUrlHelper, String, String, Object, String, String, String)

Generates a URL with an absolute path for an action method, which contains the specified action name, controller name, route values, protocol to use, host name, and fragment. Generates an absolute URL if the protocol and host are non-null. See the remarks section for important security information.

Page(IUrlHelper, String) Page(IUrlHelper, String) Page(IUrlHelper, String)

Generates a URL with a relative path for the specified pageName.

Page(IUrlHelper, String, Object) Page(IUrlHelper, String, Object) Page(IUrlHelper, String, Object)

Generates a URL with a relative path for the specified pageName.

Page(IUrlHelper, String, String) Page(IUrlHelper, String, String) Page(IUrlHelper, String, String)

Generates a URL with a relative path for the specified pageName.

Page(IUrlHelper, String, String, Object) Page(IUrlHelper, String, String, Object) Page(IUrlHelper, String, String, Object)

Generates a URL with a relative path for the specified pageName.

Page(IUrlHelper, String, String, Object, String) Page(IUrlHelper, String, String, Object, String) Page(IUrlHelper, String, String, Object, String)

Generates a URL with an absolute path for the specified pageName. See the remarks section for important security information.

Page(IUrlHelper, String, String, Object, String, String) Page(IUrlHelper, String, String, Object, String, String) Page(IUrlHelper, String, String, Object, String, String)

Generates a URL with an absolute path for the specified pageName. See the remarks section for important security information.

Page(IUrlHelper, String, String, Object, String, String, String) Page(IUrlHelper, String, String, Object, String, String, String) Page(IUrlHelper, String, String, Object, String, String, String)

Generates a URL with an absolute path for the specified pageName. See the remarks section for important security information.

RouteUrl(IUrlHelper, Object) RouteUrl(IUrlHelper, Object) RouteUrl(IUrlHelper, Object)

Generates a URL with an absolute path for the specified route values.

RouteUrl(IUrlHelper, String) RouteUrl(IUrlHelper, String) RouteUrl(IUrlHelper, String)

Generates a URL with an absolute path for the specified routeName.

RouteUrl(IUrlHelper, String, Object) RouteUrl(IUrlHelper, String, Object) RouteUrl(IUrlHelper, String, Object)

Generates a URL with an absolute path for the specified routeName and route values.

RouteUrl(IUrlHelper, String, Object, String) RouteUrl(IUrlHelper, String, Object, String) RouteUrl(IUrlHelper, String, Object, String)

Generates a URL with an absolute path for the specified route routeName and route values, which contains the specified protocol to use. See the remarks section for important security information.

RouteUrl(IUrlHelper, String, Object, String, String) RouteUrl(IUrlHelper, String, Object, String, String) RouteUrl(IUrlHelper, String, Object, String, String)

Generates a URL with an absolute path for the specified route routeName and route values, which contains the specified protocol to use and host name. Generates an absolute URL if Protocol and Host are non-null. See the remarks section for important security information.

RouteUrl(IUrlHelper, String, Object, String, String, String) RouteUrl(IUrlHelper, String, Object, String, String, String) RouteUrl(IUrlHelper, String, Object, String, String, String)

Generates a URL with an absolute path for the specified route routeName and route values, which contains the specified protocol to use, host name and fragment. Generates an absolute URL if Protocol and Host are non-null. See the remarks section for important security information.

Applies to