PageLinkGeneratorExtensions.GetUriByPage 方法

定義

多載

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

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

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

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

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

來源:
PageLinkGeneratorExtensions.cs

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

public static string GetUriByPage (this Microsoft.AspNetCore.Routing.LinkGenerator generator, string page, string handler, 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? GetUriByPage (this Microsoft.AspNetCore.Routing.LinkGenerator generator, string page, string? handler, 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 GetUriByPage : Microsoft.AspNetCore.Routing.LinkGenerator * string * string * obj * string * Microsoft.AspNetCore.Http.HostString * Microsoft.AspNetCore.Http.PathString * Microsoft.AspNetCore.Http.FragmentString * Microsoft.AspNetCore.Routing.LinkOptions -> string
<Extension()>
Public Function GetUriByPage (generator As LinkGenerator, page As String, handler 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

參數

page
String

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

handler
String

頁面處理常式名稱。 可能是 Null。

values
Object

路徑值。 可能是 Null。 用來解析端點,並展開路由範本中的參數。

scheme
String

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

host
HostString

套用至產生的 URI 的 URI 主機/授權單位。

pathBase
PathString

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

fragment
FragmentString

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

options
LinkOptions

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

傳回

絕對 URI,如果無法建立 URI,則 null 為 。

備註

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

適用於

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

來源:
PageLinkGeneratorExtensions.cs

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

public static string GetUriByPage (this Microsoft.AspNetCore.Routing.LinkGenerator generator, Microsoft.AspNetCore.Http.HttpContext httpContext, string page = default, string handler = default, object 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);
public static string? GetUriByPage (this Microsoft.AspNetCore.Routing.LinkGenerator generator, Microsoft.AspNetCore.Http.HttpContext httpContext, string? page = default, string? handler = default, object? 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 GetUriByPage : Microsoft.AspNetCore.Routing.LinkGenerator * Microsoft.AspNetCore.Http.HttpContext * string * 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 GetUriByPage (generator As LinkGenerator, httpContext As HttpContext, Optional page As String = Nothing, Optional handler As String = Nothing, Optional values As Object = 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 目前要求相關聯的 。

page
String

頁面名稱。 用來解析端點。 選擇性。 如果 null 提供 ,則會使用目前的頁面路由值。

handler
String

頁面處理常式名稱。 用來解析端點。 選擇性。

values
Object

路徑值。 選擇性。 用來解析端點,並展開路由範本中的參數。

scheme
String

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

host
Nullable<HostString>

套用至產生的 URI 的 URI 主機/授權單位。 選擇性。 如果未提供,則會使用 值 Host

pathBase
Nullable<PathString>

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

fragment
FragmentString

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

options
LinkOptions

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

傳回

絕對 URI,如果無法建立 URI,則 null 為 。

備註

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

適用於