FileServerExtensions.UseFileServer Method

Definition

Overloads

UseFileServer(IApplicationBuilder)

Enable all static file middleware (except directory browsing) for the current request path in the current directory.

UseFileServer(IApplicationBuilder, FileServerOptions)

Enable all static file middleware with the given options

UseFileServer(IApplicationBuilder, Boolean)

Enable all static file middleware on for the current request path in the current directory.

UseFileServer(IApplicationBuilder, String)

Enables all static file middleware (except directory browsing) for the given request path from the directory of the same name

UseFileServer(IApplicationBuilder)

Source:
FileServerExtensions.cs
Source:
FileServerExtensions.cs
Source:
FileServerExtensions.cs

Enable all static file middleware (except directory browsing) for the current request path in the current directory.

C#
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseFileServer (this Microsoft.AspNetCore.Builder.IApplicationBuilder app);

Parameters

Returns

Remarks

Files are served from the path specified in WebRootPath or WebRootFileProvider which defaults to the 'wwwroot' subfolder.

Applies to

ASP.NET Core 9.0 ja muut versiot
Tuote Versiot
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

UseFileServer(IApplicationBuilder, FileServerOptions)

Source:
FileServerExtensions.cs
Source:
FileServerExtensions.cs
Source:
FileServerExtensions.cs

Enable all static file middleware with the given options

C#
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseFileServer (this Microsoft.AspNetCore.Builder.IApplicationBuilder app, Microsoft.AspNetCore.Builder.FileServerOptions options);

Parameters

Returns

Applies to

ASP.NET Core 9.0 ja muut versiot
Tuote Versiot
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

UseFileServer(IApplicationBuilder, Boolean)

Source:
FileServerExtensions.cs
Source:
FileServerExtensions.cs
Source:
FileServerExtensions.cs

Enable all static file middleware on for the current request path in the current directory.

C#
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseFileServer (this Microsoft.AspNetCore.Builder.IApplicationBuilder app, bool enableDirectoryBrowsing);

Parameters

enableDirectoryBrowsing
Boolean

Should directory browsing be enabled?

Returns

Remarks

Files are served from the path specified in WebRootPath or WebRootFileProvider which defaults to the 'wwwroot' subfolder.

Applies to

ASP.NET Core 9.0 ja muut versiot
Tuote Versiot
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

UseFileServer(IApplicationBuilder, String)

Source:
FileServerExtensions.cs
Source:
FileServerExtensions.cs
Source:
FileServerExtensions.cs

Enables all static file middleware (except directory browsing) for the given request path from the directory of the same name

C#
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseFileServer (this Microsoft.AspNetCore.Builder.IApplicationBuilder app, string requestPath);

Parameters

requestPath
String

The relative request path.

Returns

Remarks

Files are served from the path specified in WebRootPath or WebRootFileProvider which defaults to the 'wwwroot' subfolder.

Applies to

ASP.NET Core 9.0 ja muut versiot
Tuote Versiot
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0