LinkGeneratorEndpointNameAddressExtensions.GetUriByName 方法

定義

多載

GetUriByName(LinkGenerator, String, RouteValueDictionary, String, HostString, PathString, FragmentString, LinkOptions)

根據提供的值產生絕對 URI。

GetUriByName(LinkGenerator, String, Object, String, HostString, PathString, FragmentString, LinkOptions)

根據提供的值產生絕對 URI。

GetUriByName(LinkGenerator, HttpContext, String, RouteValueDictionary, String, Nullable<HostString>, Nullable<PathString>, FragmentString, LinkOptions)

根據提供的值產生絕對 URI。

GetUriByName(LinkGenerator, HttpContext, String, Object, String, Nullable<HostString>, Nullable<PathString>, FragmentString, LinkOptions)

根據提供的值產生絕對 URI。

GetUriByName(LinkGenerator, String, RouteValueDictionary, String, HostString, PathString, FragmentString, LinkOptions)

根據提供的值產生絕對 URI。

public static string? GetUriByName (this Microsoft.AspNetCore.Routing.LinkGenerator generator, string endpointName, Microsoft.AspNetCore.Routing.RouteValueDictionary values, string scheme, Microsoft.AspNetCore.Http.HostString host, Microsoft.AspNetCore.Http.PathString pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions? options = default);
static member GetUriByName : Microsoft.AspNetCore.Routing.LinkGenerator * string * Microsoft.AspNetCore.Routing.RouteValueDictionary * string * Microsoft.AspNetCore.Http.HostString * Microsoft.AspNetCore.Http.PathString * Microsoft.AspNetCore.Http.FragmentString * Microsoft.AspNetCore.Routing.LinkOptions -> string
<Extension()>
Public Function GetUriByName (generator As LinkGenerator, endpointName As String, values As RouteValueDictionary, scheme As String, host As HostString, Optional pathBase As PathString = Nothing, Optional fragment As FragmentString = Nothing, Optional options As LinkOptions = Nothing) As String

參數

endpointName
String

端點名稱。 用來解析端點。

values
RouteValueDictionary

路徑值。 用來展開路由範本中的參數。

scheme
String

套用至產生的 URI 的 URI 配置。

host
HostString

套用至產生的 URI 的 URI 主機/授權單位。 如需 有關 的安全性含意 host 的詳細資訊,請參閱一節。

pathBase
PathString

選擇性 URI 路徑基底。 在產生的 URI 中,前面加上路徑。

fragment
FragmentString

選擇性 URI 片段。 附加至產生的 URI。

options
LinkOptions

選擇性 LinkOptions。 所提供物件的設定會覆寫具有相符名稱的 RouteOptions 設定。

傳回

絕對 URI 或 null

備註

的值 host 應該是受信任的值。 除非已驗證標頭,否則 Host 依賴目前要求的值可允許不受信任的輸入影響產生的 URI。 如需如何在部署環境中正確驗證 Host 標頭的指示,請參閱部署檔。

適用於

GetUriByName(LinkGenerator, String, Object, String, HostString, PathString, FragmentString, LinkOptions)

根據提供的值產生絕對 URI。

public static string GetUriByName (this Microsoft.AspNetCore.Routing.LinkGenerator generator, string endpointName, object values, string scheme, Microsoft.AspNetCore.Http.HostString host, Microsoft.AspNetCore.Http.PathString pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions options = default);
public static string? GetUriByName (this Microsoft.AspNetCore.Routing.LinkGenerator generator, string endpointName, object? values, string scheme, Microsoft.AspNetCore.Http.HostString host, Microsoft.AspNetCore.Http.PathString pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions? options = default);
static member GetUriByName : Microsoft.AspNetCore.Routing.LinkGenerator * string * obj * string * Microsoft.AspNetCore.Http.HostString * Microsoft.AspNetCore.Http.PathString * Microsoft.AspNetCore.Http.FragmentString * Microsoft.AspNetCore.Routing.LinkOptions -> string
<Extension()>
Public Function GetUriByName (generator As LinkGenerator, endpointName As String, values As Object, scheme As String, host As HostString, Optional pathBase As PathString = Nothing, Optional fragment As FragmentString = Nothing, Optional options As LinkOptions = Nothing) As String

參數

endpointName
String

端點名稱。 用來解析端點。

values
Object

路徑值。 用來展開路由範本中的參數。 選擇性。

scheme
String

套用至產生的 URI 的 URI 配置。

host
HostString

套用至產生的 URI 的 URI 主機/授權單位。 如需 有關 的安全性含意 host 的詳細資訊,請參閱一節。

pathBase
PathString

選擇性 URI 路徑基底。 在產生的 URI 中,前面加上路徑。

fragment
FragmentString

選擇性 URI 片段。 附加至產生的 URI。

options
LinkOptions

選擇性 LinkOptions。 所提供物件的設定會覆寫具有相符名稱的 RouteOptions 設定。

傳回

絕對 URI 或 null

備註

的值 host 應該是受信任的值。 除非已驗證標頭,否則 Host 依賴目前要求的值可允許不受信任的輸入影響產生的 URI。 如需如何在部署環境中正確驗證 Host 標頭的指示,請參閱部署檔。

適用於

GetUriByName(LinkGenerator, HttpContext, String, RouteValueDictionary, String, Nullable<HostString>, Nullable<PathString>, FragmentString, LinkOptions)

根據提供的值產生絕對 URI。

public static string? GetUriByName (this Microsoft.AspNetCore.Routing.LinkGenerator generator, Microsoft.AspNetCore.Http.HttpContext httpContext, string endpointName, Microsoft.AspNetCore.Routing.RouteValueDictionary? values = default, string? scheme = default, Microsoft.AspNetCore.Http.HostString? host = default, Microsoft.AspNetCore.Http.PathString? pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions? options = default);
static member GetUriByName : Microsoft.AspNetCore.Routing.LinkGenerator * Microsoft.AspNetCore.Http.HttpContext * string * Microsoft.AspNetCore.Routing.RouteValueDictionary * string * Nullable<Microsoft.AspNetCore.Http.HostString> * Nullable<Microsoft.AspNetCore.Http.PathString> * Microsoft.AspNetCore.Http.FragmentString * Microsoft.AspNetCore.Routing.LinkOptions -> string
<Extension()>
Public Function GetUriByName (generator As LinkGenerator, httpContext As HttpContext, endpointName As String, Optional values As RouteValueDictionary = Nothing, Optional scheme As String = Nothing, Optional host As Nullable(Of HostString) = Nothing, Optional pathBase As Nullable(Of PathString) = Nothing, Optional fragment As FragmentString = Nothing, Optional options As LinkOptions = Nothing) As String

參數

httpContext
HttpContext

HttpContext 目前要求相關聯的 。

endpointName
String

端點名稱。 用來解析端點。

values
RouteValueDictionary

路徑值。 用來展開路由範本中的參數。 選擇性。

scheme
String

套用至產生的 URI 的 URI 配置。 選擇性。 如果未提供,則會使用 的值 Scheme

host
Nullable<HostString>

套用至產生的 URI 的 URI 主機/授權單位。 選擇性。 如果未提供,則會使用 值 Host 。 如需 有關 的安全性含意 host 的詳細資訊,請參閱一節。

pathBase
Nullable<PathString>

選擇性 URI 路徑基底。 在產生的 URI 中,前面加上路徑。 如果未提供,則會使用 的值 PathBase

fragment
FragmentString

選擇性 URI 片段。 附加至產生的 URI。

options
LinkOptions

選擇性 LinkOptions。 所提供物件的設定會覆寫具有相符名稱的 RouteOptions 設定。

傳回

具有絕對路徑的 URI,或 null

備註

的值 host 應該是受信任的值。 除非已驗證標頭,否則 Host 依賴目前要求的值可允許不受信任的輸入影響產生的 URI。 如需如何在部署環境中正確驗證 Host 標頭的指示,請參閱部署檔。

適用於

GetUriByName(LinkGenerator, HttpContext, String, Object, String, Nullable<HostString>, Nullable<PathString>, FragmentString, LinkOptions)

根據提供的值產生絕對 URI。

public static string GetUriByName (this Microsoft.AspNetCore.Routing.LinkGenerator generator, Microsoft.AspNetCore.Http.HttpContext httpContext, string endpointName, object values, string scheme = default, Microsoft.AspNetCore.Http.HostString? host = default, Microsoft.AspNetCore.Http.PathString? pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions options = default);
public static string? GetUriByName (this Microsoft.AspNetCore.Routing.LinkGenerator generator, Microsoft.AspNetCore.Http.HttpContext httpContext, string endpointName, object? values, string? scheme = default, Microsoft.AspNetCore.Http.HostString? host = default, Microsoft.AspNetCore.Http.PathString? pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions? options = default);
static member GetUriByName : Microsoft.AspNetCore.Routing.LinkGenerator * Microsoft.AspNetCore.Http.HttpContext * string * obj * string * Nullable<Microsoft.AspNetCore.Http.HostString> * Nullable<Microsoft.AspNetCore.Http.PathString> * Microsoft.AspNetCore.Http.FragmentString * Microsoft.AspNetCore.Routing.LinkOptions -> string
<Extension()>
Public Function GetUriByName (generator As LinkGenerator, httpContext As HttpContext, endpointName As String, values As Object, Optional scheme As String = Nothing, Optional host As Nullable(Of HostString) = Nothing, Optional pathBase As Nullable(Of PathString) = Nothing, Optional fragment As FragmentString = Nothing, Optional options As LinkOptions = Nothing) As String

參數

httpContext
HttpContext

HttpContext 目前要求相關聯的 。

endpointName
String

端點名稱。 用來解析端點。

values
Object

路徑值。 用來展開路由範本中的參數。 選擇性。

scheme
String

套用至產生的 URI 的 URI 配置。 選擇性。 如果未提供,則會使用 的值 Scheme

host
Nullable<HostString>

套用至產生的 URI 的 URI 主機/授權單位。 選擇性。 如果未提供,則會使用 值 Host 。 如需 有關 的安全性含意 host 的詳細資訊,請參閱一節。

pathBase
Nullable<PathString>

選擇性 URI 路徑基底。 在產生的 URI 中,前面加上路徑。 如果未提供,則會使用 的值 PathBase

fragment
FragmentString

選擇性 URI 片段。 附加至產生的 URI。

options
LinkOptions

選擇性 LinkOptions。 所提供物件的設定會覆寫具有相符名稱的 RouteOptions 設定。

傳回

具有絕對路徑的 URI,或 null

備註

的值 host 應該是受信任的值。 除非已驗證標頭,否則 Host 依賴目前要求的值可允許不受信任的輸入影響產生的 URI。 如需如何在部署環境中正確驗證 Host 標頭的指示,請參閱部署檔。

適用於