当前位置: 动力学知识库 > 问答 > 编程问答 >

asp.net core - Static directory an default files but without trailing slash?

问题描述:

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

});

}

分享给朋友:
您可能感兴趣的文章:
随机阅读: