UrlHelper 类

定义

IUrlHelper 实现,其中包含用于在应用程序中生成 ASP.NET MVC 的 URL 的方法。

public ref class UrlHelper : Microsoft::AspNetCore::Mvc::IUrlHelper
public ref class UrlHelper : Microsoft::AspNetCore::Mvc::Routing::UrlHelperBase
public class UrlHelper : Microsoft.AspNetCore.Mvc.IUrlHelper
public class UrlHelper : Microsoft.AspNetCore.Mvc.Routing.UrlHelperBase
type UrlHelper = class
    interface IUrlHelper
type UrlHelper = class
    inherit UrlHelperBase
Public Class UrlHelper
Implements IUrlHelper
Public Class UrlHelper
Inherits UrlHelperBase
继承
UrlHelper
继承
UrlHelper
实现

构造函数

UrlHelper(ActionContext)

使用指定的 UrlHelper 初始化 actionContext 类的新实例。

属性

ActionContext

获取当前请求的 ActionContext

ActionContext

获取当前请求的 ActionContext

(继承自 UrlHelperBase)
AmbientValues

获取与 RouteValueDictionary 当前请求关联的 。

AmbientValues

获取与 RouteValueDictionary 当前请求关联的 。

(继承自 UrlHelperBase)
HttpContext

获取与 HttpContext 当前请求关联的 。

Router

获取与当前请求关联的顶级 IRouter 。 通常为实现 IRouteCollection

方法

Action(UrlActionContext)

生成包含操作方法的绝对路径的 URL,其中包含操作名称、控制器名称、路由值、要使用的协议、主机名和指定的 UrlActionContext片段。 如果 ProtocolHost 为非null,则生成绝对 URL。 有关重要的安全信息,请参阅备注部分。

Content(String)

从 ~/) 路径开始,将虚拟 (相对路径转换为应用程序绝对路径。

Content(String)

从 ~/) 路径开始,将虚拟 (相对路径转换为应用程序绝对路径。

(继承自 UrlHelperBase)
GenerateUrl(String, String, String)

从提供的组件生成 URI。

(继承自 UrlHelperBase)
GenerateUrl(String, String, String, String)

使用指定的值生成 URL。

(继承自 UrlHelperBase)
GenerateUrl(String, String, VirtualPathData, String)

使用指定的组件生成 URL。

GetValuesDictionary(Object)

RouteValueDictionary使用指定值获取 。

(继承自 UrlHelperBase)
GetVirtualPathData(String, RouteValueDictionary)

VirtualPathData获取指定 routeName 和 路由 values的 。

IsLocalUrl(String)

返回一个值,该值指示 URL 是否为本地 URL。 如果 URL 没有主机/颁发机构部件并且具有绝对路径,则将其视为本地 URL。 使用虚拟路径 ('~/') 的 URL 也是本地的。

IsLocalUrl(String)

返回一个值,该值指示 URL 是否为本地 URL。 如果 URL 没有主机/颁发机构部件并且具有绝对路径,则将其视为本地 URL。 使用虚拟路径 ('~/') 的 URL 也是本地的。

(继承自 UrlHelperBase)
Link(String, Object)

为指定的 routeName 和 路由 values生成绝对 URL,其中包含当前请求中的协议 ((例如“http”或“https”) 和主机名)。 有关重要的安全信息,请参阅备注部分。

Link(String, Object)

为指定的 routeName 和 路由 values生成绝对 URL,其中包含当前请求中的协议 ((例如“http”或“https”) 和主机名)。 有关重要的安全信息,请参阅备注部分。

(继承自 UrlHelperBase)
RouteUrl(UrlRouteContext)

生成具有绝对路径的 URL,其中包含路由名称、路由值、要使用的协议、主机名和指定的 UrlRouteContext片段。 如果 ProtocolHost 为非null,则生成绝对 URL。 有关重要的安全信息,请参阅备注部分。

扩展方法

Action(IUrlHelper)

生成具有操作方法路径的 URL。

Action(IUrlHelper, String)

生成包含指定 action 名称的操作方法路径的 URL。

Action(IUrlHelper, String, Object)

生成一个 URL,其中包含操作方法的路径,其中包含指定的 action 名称和路由 values

Action(IUrlHelper, String, String)

生成一个 URL,其中包含操作方法的路径,其中包含指定的 actioncontroller 名称。

Action(IUrlHelper, String, String, Object)

生成一个 URL,其中包含操作方法的路径,其中包含指定 action 的名称、 controller 名称和路由 values

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

生成一个 URL,其中包含操作方法的路径,其中包含要使用的指定 action 名称、 controller 名称、路由 valuesprotocol 。 有关重要的安全信息,请参阅备注部分。

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

生成一个 URL,其中包含操作方法的路径,其中包含指定的 action 名称、 controller 名称、路由 valuesprotocol 要使用的和 host 名称。 如果 和 host 为非nullprotocol则生成绝对 URL。 有关重要的安全信息,请参阅备注部分。

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

生成一个 URL,其中包含操作方法的路径,其中包含指定的 action 名称、名称、 controller 路由 valuesprotocol 要使用的名称、 host 名称和 fragment。 如果 和 host 为非nullprotocol则生成绝对 URL。 有关重要的安全信息,请参阅备注部分。

ActionLink(IUrlHelper, String, String, Object, String, String, String)

为操作方法生成绝对 URL,该方法包含指定的 action 名称、名称、 controller 路由 valuesprotocol 要使用的名称、 host 名称和 fragment。 如果 和 host 为非nullprotocol则生成绝对 URL。 有关重要的安全信息,请参阅备注部分。

Page(IUrlHelper, String)

生成具有指定 pageName的相对路径的 URL。

Page(IUrlHelper, String, Object)

生成具有指定 pageName的相对路径的 URL。

Page(IUrlHelper, String, String)

生成具有指定 pageName的相对路径的 URL。

Page(IUrlHelper, String, String, Object)

生成具有指定 pageName的相对路径的 URL。

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

生成具有指定 pageName的绝对路径的 URL。 有关重要的安全信息,请参阅备注部分。

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

生成具有指定 pageName的绝对路径的 URL。 有关重要的安全信息,请参阅备注部分。

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

生成具有指定 pageName的绝对路径的 URL。 有关重要的安全信息,请参阅备注部分。

PageLink(IUrlHelper, String, String, Object, String, String, String)

为页面生成绝对 URL,其中包含指定的 pageName、、 pageHandler路由 valuesprotocol 要使用的、 hostfragment名称和 。 如果 和 host 为非nullprotocol则生成绝对 URL。 有关重要的安全信息,请参阅备注部分。

RouteUrl(IUrlHelper, Object)

生成具有指定路由 values的绝对路径的 URL。

RouteUrl(IUrlHelper, String)

生成具有指定 routeName的绝对路径的 URL。

RouteUrl(IUrlHelper, String, Object)

生成具有指定 routeName 和 路由 values的绝对路径的 URL。

RouteUrl(IUrlHelper, String, Object, String)

生成一个 URL,其中包含指定路由 routeName 和路由 values的绝对路径,其中包含要使用的指定 protocol 。 有关重要的安全信息,请参阅备注部分。

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

生成一个 URL,其中包含指定路由 routeName 和路由 values的绝对路径,其中包含指定 protocol 要使用的 和 host 名称。 如果 ProtocolHost 为非null,则生成绝对 URL。 有关重要的安全信息,请参阅备注部分。

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

生成具有指定路由 routeName 和路由 values的绝对路径的 URL,其中包含要使用的指定 protocolhost 名称和 fragment。 如果 ProtocolHost 为非null,则生成绝对 URL。 有关重要的安全信息,请参阅备注部分。

适用于