UrlHelperExtensions.RouteUrl 方法

定义

重载

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

生成具有指定路由和路由 routeNamevalues的绝对路径的 URL,其中包含 protocol 要使用的 指定和 host 名称。 如果 ProtocolHost 为非null,则生成绝对 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, String)

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

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

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

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ RouteUrl(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::String ^ routeName, System::Object ^ values, System::String ^ protocol, System::String ^ host);
public static string RouteUrl (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string routeName, object values, string protocol, string host);
public static string? RouteUrl (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string? routeName, object? values, string? protocol, string? host);
static member RouteUrl : Microsoft.AspNetCore.Mvc.IUrlHelper * string * obj * string * string -> string
<Extension()>
Public Function RouteUrl (helper As IUrlHelper, routeName As String, values As Object, protocol As String, host As String) As String

参数

routeName
String

用于生成 URL 的路由的名称。

values
Object

一个包含路由值的 对象。

protocol
String

URL 协议,如“http”或“https”。

host
String

URL 的主机名。

返回

生成的 URL。

注解

的值 host 应为受信任的值。 依赖当前请求的值可能会允许不受信任的输入影响生成的 URI, Host 除非标头已经过验证。 有关如何在部署环境中正确验证标头的说明, Host 请参阅部署文档。

适用于

RouteUrl(IUrlHelper, Object)

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

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ RouteUrl(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::Object ^ values);
public static string RouteUrl (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, object values);
public static string? RouteUrl (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, object? values);
static member RouteUrl : Microsoft.AspNetCore.Mvc.IUrlHelper * obj -> string
<Extension()>
Public Function RouteUrl (helper As IUrlHelper, values As Object) As String

参数

values
Object

一个包含路由值的 对象。

返回

生成的 URL。

适用于

RouteUrl(IUrlHelper, String)

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

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ RouteUrl(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::String ^ routeName);
public static string RouteUrl (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string routeName);
public static string? RouteUrl (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string? routeName);
static member RouteUrl : Microsoft.AspNetCore.Mvc.IUrlHelper * string -> string
<Extension()>
Public Function RouteUrl (helper As IUrlHelper, routeName As String) As String

参数

routeName
String

用于生成 URL 的路由的名称。

返回

生成的 URL。

适用于

RouteUrl(IUrlHelper, String, Object)

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

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ RouteUrl(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::String ^ routeName, System::Object ^ values);
public static string RouteUrl (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string routeName, object values);
public static string? RouteUrl (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string? routeName, object? values);
static member RouteUrl : Microsoft.AspNetCore.Mvc.IUrlHelper * string * obj -> string
<Extension()>
Public Function RouteUrl (helper As IUrlHelper, routeName As String, values As Object) As String

参数

routeName
String

用于生成 URL 的路由的名称。

values
Object

一个包含路由值的 对象。

返回

生成的 URL。

适用于

RouteUrl(IUrlHelper, String, Object, String)

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

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ RouteUrl(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::String ^ routeName, System::Object ^ values, System::String ^ protocol);
public static string RouteUrl (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string routeName, object values, string protocol);
public static string? RouteUrl (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string? routeName, object? values, string? protocol);
static member RouteUrl : Microsoft.AspNetCore.Mvc.IUrlHelper * string * obj * string -> string
<Extension()>
Public Function RouteUrl (helper As IUrlHelper, routeName As String, values As Object, protocol As String) As String

参数

routeName
String

用于生成 URL 的路由的名称。

values
Object

一个包含路由值的 对象。

protocol
String

URL 协议,如“http”或“https”。

返回

生成的 URL。

注解

此方法使用 的值 Host 来填充生成的 URI 的主机部分。 依赖当前请求的值可能会允许不受信任的输入影响生成的 URI, Host 除非标头已经过验证。 有关如何在部署环境中正确验证标头的说明, Host 请参阅部署文档。

适用于

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

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

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ RouteUrl(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::String ^ routeName, System::Object ^ values, System::String ^ protocol, System::String ^ host, System::String ^ fragment);
public static string RouteUrl (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string routeName, object values, string protocol, string host, string fragment);
public static string? RouteUrl (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string? routeName, object? values, string? protocol, string? host, string? fragment);
static member RouteUrl : Microsoft.AspNetCore.Mvc.IUrlHelper * string * obj * string * string * string -> string
<Extension()>
Public Function RouteUrl (helper As IUrlHelper, routeName As String, values As Object, protocol As String, host As String, fragment As String) As String

参数

routeName
String

用于生成 URL 的路由的名称。

values
Object

一个包含路由值的 对象。

protocol
String

URL 协议,如“http”或“https”。

host
String

URL 的主机名。

fragment
String

URL 的片段。

返回

生成的 URL。

注解

的值 host 应为受信任的值。 依赖当前请求的值可能会允许不受信任的输入影响生成的 URI, Host 除非标头已经过验证。 有关如何在部署环境中正确验证标头的说明, Host 请参阅部署文档。

适用于