UrlHelperExtensions.RouteUrl 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
RouteUrl(IUrlHelper, String, Object, String, String) |
產生具有指定路由和路由 |
RouteUrl(IUrlHelper, Object) |
產生具有指定路由 |
RouteUrl(IUrlHelper, String) |
產生具有指定 |
RouteUrl(IUrlHelper, String, Object) |
為指定的 |
RouteUrl(IUrlHelper, String, Object, String) |
產生具有指定路由和路由 |
RouteUrl(IUrlHelper, String, Object, String, String, String) |
產生具有指定路由和路由 |
RouteUrl(IUrlHelper, String, Object, String, String)
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
參數
- helper
- IUrlHelper
- routeName
- String
用來產生 URL 之路徑的名稱。
- values
- Object
包含路由值的物件。
- protocol
- String
URL 的通訊協定,例如 "http" 或 "https"。
- host
- String
URL 的主機名稱。
傳回
產生的 URL。
備註
的值 host
應該是受信任的值。 除非已驗證標頭,否則 Host
依賴目前要求的值可允許不受信任的輸入影響產生的 URI。 如需如何在部署環境中正確驗證 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
參數
- helper
- IUrlHelper
- 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
參數
- helper
- IUrlHelper
- 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
參數
- helper
- IUrlHelper
- routeName
- String
用來產生 URL 之路徑的名稱。
- values
- Object
包含路由值的物件。
傳回
產生的 URL。
適用於
RouteUrl(IUrlHelper, String, Object, String)
產生具有指定路由和路由 routeName
values
絕對路徑的 URL,其中包含要使用的指定 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
參數
- helper
- IUrlHelper
- routeName
- String
用來產生 URL 之路徑的名稱。
- values
- Object
包含路由值的物件。
- protocol
- String
URL 的通訊協定,例如 "http" 或 "https"。
傳回
產生的 URL。
備註
這個方法會使用 的值 Host 來填入所產生 URI 的主機區段。 除非已驗證標頭,否則 Host
依賴目前要求的值可允許不受信任的輸入影響產生的 URI。 如需如何在部署環境中正確驗證 Host
標頭的指示,請參閱部署檔。
適用於
RouteUrl(IUrlHelper, String, Object, String, String, String)
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
參數
- helper
- IUrlHelper
- routeName
- String
用來產生 URL 之路徑的名稱。
- values
- Object
包含路由值的物件。
- protocol
- String
URL 的通訊協定,例如 "http" 或 "https"。
- host
- String
URL 的主機名稱。
- fragment
- String
URL 的片段。
傳回
產生的 URL。
備註
的值 host
應該是受信任的值。 除非已驗證標頭,否則 Host
依賴目前要求的值可允許不受信任的輸入影響產生的 URI。 如需如何在部署環境中正確驗證 Host
標頭的指示,請參閱部署檔。