CaseInsensitiveStaticFile is an ASP.NET Core Middleware that enables case-insensitive static files, the libaray is base on .NET Standard 2.0.
If this project has been helpful for you and you want to support it, please consider Buying me a coffee☕
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);