Skip to content

An ASP.NET Core Middleware that enables case-insensitive static files.

License

Notifications You must be signed in to change notification settings

XiaoFaye/CaseInsensitiveStaticFile

Repository files navigation

CaseInsensitiveStaticFile

A Brief Intro

CaseInsensitiveStaticFile is an ASP.NET Core Middleware that enables case-insensitive static files, the libaray is base on .NET Standard 2.0.

NuGet

If this project has been helpful for you and you want to support it, please consider Buying me a coffee

Usage

Click to expand/collapse details...
using CaseInsensitiveStaticFile;

//In Startup class, Configure function

app.UseStaticFiles();

app.UseStaticFiles(new StaticFileOptions()
{
    FileProvider = new PhysicalFileProvider(@"/home/james/folderA/"),
    RequestPath = new PathString("/files"),
    DefaultContentType = "application/octet-stream",
    ServeUnknownFileTypes = true
});

app.UseStaticFiles(new StaticFileOptions()
{
    FileProvider = new PhysicalFileProvider(@"/home/james/folderB"),
    RequestPath = new PathString("/softwares"),
    DefaultContentType = "application/octet-stream",
    ServeUnknownFileTypes = true
});

Dictionary<string, string> providers = new Dictionary<string, string>();
providers.Add("/", env.WebRootPath);	//This is for the default wwwroot static file provider.
providers.Add("/files", @"/home/james/folderA/");
providers.Add("/softwares", @"/home/james/folderB");

app.UseCaseInsensitiveStaticFile(providers);

About

An ASP.NET Core Middleware that enables case-insensitive static files.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages