StaticFilesEndpointRouteBuilderExtensions.MapFallbackToFile Method

Definition

Overloads

MapFallbackToFile(IEndpointRouteBuilder, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-filenames with the lowest possible priority. The request will be routed to a StaticFileMiddleware that attempts to serve the file specified by filePath.

MapFallbackToFile(IEndpointRouteBuilder, String, StaticFileOptions)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-filenames with the lowest possible priority. The request will be routed to a StaticFileMiddleware that attempts to serve the file specified by filePath.

MapFallbackToFile(IEndpointRouteBuilder, String, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-filenames with the lowest possible priority. The request will be routed to a StaticFileMiddleware that attempts to serve the file specified by filePath.

MapFallbackToFile(IEndpointRouteBuilder, String, String, StaticFileOptions)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-filenames with the lowest possible priority. The request will be routed to a StaticFileMiddleware that attempts to serve the file specified by filePath.

MapFallbackToFile(IEndpointRouteBuilder, String)

Source:
StaticFilesEndpointRouteBuilderExtensions.cs

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-filenames with the lowest possible priority. The request will be routed to a StaticFileMiddleware that attempts to serve the file specified by filePath.

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

Parameters

filePath
String

The file path of the file to serve.

Returns

The IEndpointRouteBuilder

Remarks

MapFallbackToFile(IEndpointRouteBuilder, String) is intended to handle cases where URL path of the request does not contain a filename, 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.

The default StaticFileOptions for the StaticFileMiddleware will be used.

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

Applies to

MapFallbackToFile(IEndpointRouteBuilder, String, StaticFileOptions)

Source:
StaticFilesEndpointRouteBuilderExtensions.cs

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-filenames with the lowest possible priority. The request will be routed to a StaticFileMiddleware that attempts to serve the file specified by filePath.

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

Parameters

filePath
String

The file path of the file to serve.

Returns

The IEndpointRouteBuilder

Remarks

MapFallbackToFile(IEndpointRouteBuilder, String, StaticFileOptions) 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.

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

Applies to

MapFallbackToFile(IEndpointRouteBuilder, String, String)

Source:
StaticFilesEndpointRouteBuilderExtensions.cs

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-filenames with the lowest possible priority. The request will be routed to a StaticFileMiddleware that attempts to serve the file specified by filePath.

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

Parameters

pattern
String

The route pattern.

filePath
String

The file path of the file to serve.

Returns

The IEndpointRouteBuilder

Remarks

MapFallbackToFile(IEndpointRouteBuilder, String, String) is intended to handle cases where URL path of the request does not contain a filename, 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.

The default StaticFileOptions for the StaticFileMiddleware will be used.

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

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

Applies to

MapFallbackToFile(IEndpointRouteBuilder, String, String, StaticFileOptions)

Source:
StaticFilesEndpointRouteBuilderExtensions.cs

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-filenames with the lowest possible priority. The request will be routed to a StaticFileMiddleware that attempts to serve the file specified by filePath.

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

Parameters

pattern
String

The route pattern.

filePath
String

The file path of the file to serve.

Returns

The IEndpointRouteBuilder

Remarks

MapFallbackToFile(IEndpointRouteBuilder, String, String, StaticFileOptions) is intended to handle cases where URL path of the request does not contain a filename, 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.

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

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

Applies to