語言

RazorPagesEndpointRouteBuilderExtensions.MapFallbackToPage 方法

定義

多載

名稱 Description
MapFallbackToPage(IEndpointRouteBuilder, String)

在 中RouteEndpoint加入一個專用IEndpointRouteBuilder碼,能將非檔案名稱的請求匹配到最低優先順序。 請求會被路由到與 相符 page的頁面端點。

MapFallbackToPage(IEndpointRouteBuilder, String, String)

在 中RouteEndpoint加入一個專用IEndpointRouteBuilder碼,能將非檔案名稱的請求匹配到最低優先順序。 請求會被路由到與 相符 page的頁面端點。

MapFallbackToPage(IEndpointRouteBuilder, String)

來源:
RazorPagesEndpointRouteBuilderExtensions.cs

在 中RouteEndpoint加入一個專用IEndpointRouteBuilder碼,能將非檔案名稱的請求匹配到最低優先順序。 請求會被路由到與 相符 page的頁面端點。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IEndpointConventionBuilder ^ MapFallbackToPage(Microsoft::AspNetCore::Routing::IEndpointRouteBuilder ^ endpoints, System::String ^ page);
public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapFallbackToPage(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string page);
static member MapFallbackToPage : Microsoft.AspNetCore.Routing.IEndpointRouteBuilder * string -> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder
<Extension()>
Public Function MapFallbackToPage (endpoints As IEndpointRouteBuilder, page As String) As IEndpointConventionBuilder

參數

endpoints
IEndpointRouteBuilder

IEndpointRouteBuilder要把路線加入去。

page
String

頁面名稱。

傳回

備註

MapFallbackToPage(IEndpointRouteBuilder, String) 旨在處理請求的 URL 路徑不包含檔案名稱,且沒有其他端點匹配的情況。 這對於將動態內容的請求路由到 SPA 框架很方便,同時也允許對不存在檔案的請求產生 HTTP 404。

MapFallbackToPage(IEndpointRouteBuilder, String) 以模式 {*path:nonfile}註冊端點。 註冊端點的順序為 int.MaxValue。

MapFallbackToPage(IEndpointRouteBuilder, String) 不會重新執行路由,也不會根據其他地方定義的路由產生路由值。 使用此超載時, path 路由值將可用。

適用於

MapFallbackToPage(IEndpointRouteBuilder, String, String)

來源:
RazorPagesEndpointRouteBuilderExtensions.cs

在 中RouteEndpoint加入一個專用IEndpointRouteBuilder碼,能將非檔案名稱的請求匹配到最低優先順序。 請求會被路由到與 相符 page的頁面端點。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IEndpointConventionBuilder ^ MapFallbackToPage(Microsoft::AspNetCore::Routing::IEndpointRouteBuilder ^ endpoints, System::String ^ pattern, System::String ^ page);
public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapFallbackToPage(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, string page);
static member MapFallbackToPage : Microsoft.AspNetCore.Routing.IEndpointRouteBuilder * string * string -> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder
<Extension()>
Public Function MapFallbackToPage (endpoints As IEndpointRouteBuilder, pattern As String, page As String) As IEndpointConventionBuilder

參數

endpoints
IEndpointRouteBuilder

IEndpointRouteBuilder要把路線加入去。

pattern
String

路線模式。

page
String

動作名稱。

傳回

備註

MapFallbackToPage(IEndpointRouteBuilder, String, String) 旨在處理請求的 URL 路徑不包含檔案名稱,且沒有其他端點匹配的情況。 這對於將動態內容的請求路由到 SPA 框架很方便,同時也允許對不存在檔案的請求產生 HTTP 404。

註冊端點的順序為 int.MaxValue。

這次過載會使用提供的 pattern 原文。 使用 :nonfile 路由限制來排除靜態檔案的請求。

MapFallbackToPage(IEndpointRouteBuilder, String, String) 不會重新執行路由,也不會根據其他地方定義的路由產生路由值。 使用此超載時,匹配所提供的 pattern 路由值將被提供。

適用於