FallbackEndpointRouteBuilderExtensions.MapFallback Method

Definition

Overloads

MapFallback(IEndpointRouteBuilder, RequestDelegate)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority.

MapFallback(IEndpointRouteBuilder, String, RequestDelegate)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match the provided pattern with the lowest possible priority.

MapFallback(IEndpointRouteBuilder, RequestDelegate)

Source:
FallbackEndpointRouteBuilderExtensions.cs

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IEndpointConventionBuilder ^ MapFallback(Microsoft::AspNetCore::Routing::IEndpointRouteBuilder ^ endpoints, Microsoft::AspNetCore::Http::RequestDelegate ^ requestDelegate);
public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapFallback (this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, Microsoft.AspNetCore.Http.RequestDelegate requestDelegate);
static member MapFallback : Microsoft.AspNetCore.Routing.IEndpointRouteBuilder * Microsoft.AspNetCore.Http.RequestDelegate -> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder
<Extension()>
Public Function MapFallback (endpoints As IEndpointRouteBuilder, requestDelegate As RequestDelegate) As IEndpointConventionBuilder

Parameters

endpoints
IEndpointRouteBuilder

The IEndpointRouteBuilder to add the route to.

requestDelegate
RequestDelegate

The delegate executed when the endpoint is matched.

Returns

A IEndpointConventionBuilder that can be used to further customize the endpoint.

Remarks

MapFallback(IEndpointRouteBuilder, RequestDelegate) is intended to handle cases where URL path of the request does not contain a file name, and no other endpoint has matched. This is convenient for routing requests for dynamic content to a SPA framework, while also allowing requests for non-existent files to result in an HTTP 404.

MapFallback(IEndpointRouteBuilder, RequestDelegate) registers an endpoint using the pattern {*path:nonfile}. The order of the registered endpoint will be int.MaxValue.

Applies to

MapFallback(IEndpointRouteBuilder, String, RequestDelegate)

Source:
FallbackEndpointRouteBuilderExtensions.cs

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match the provided pattern with the lowest possible priority.

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

Parameters

endpoints
IEndpointRouteBuilder

The IEndpointRouteBuilder to add the route to.

pattern
String

The route pattern.

requestDelegate
RequestDelegate

The delegate executed when the endpoint is matched.

Returns

A IEndpointConventionBuilder that can be used to further customize the endpoint.

Remarks

MapFallback(IEndpointRouteBuilder, String, RequestDelegate) is intended to handle cases where no other endpoint has matched. This is convenient for routing requests to a SPA framework.

The order of the registered endpoint will be int.MaxValue.

This overload will use the provided pattern verbatim. Use the :nonfile route constraint to exclude requests for static files.

Applies to