问题描述:

What is the easiest way to serve up a static tree of folders containing index.html default files so that the route does not have a trailing slash? e.g. this

example.com/folder

and not this

example.com/folder/

I am following https://docs.microsoft.com/en-us/aspnet/core/fundamentals/static-files so my configure looks something like:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)

{

app.UseStaticFiles();

app.UseFileServer(new FileServerOptions()

{

FileProvider = new PhysicalFileProvider(

Path.Combine(Directory.GetCurrentDirectory(), @"MyStaticFiles")),

RequestPath = new PathString("/folder"),

EnableDirectoryBrowsing = false

});

}

相关阅读:
Top