refabrique, pour chaine de connection en statique
This commit is contained in:
parent
ab950ed3aa
commit
5b195c87d8
3 changed files with 72 additions and 46 deletions
33
Yavsc/Startup/Startup.FileServer.cs
Normal file
33
Yavsc/Startup/Startup.FileServer.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System.IO;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.FileProviders;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.StaticFiles;
|
||||
|
||||
namespace Yavsc
|
||||
{
|
||||
|
||||
public partial class Startup
|
||||
{
|
||||
public static string UserFilesDirName { get; private set; }
|
||||
public void ConfigureFileServerApp(IApplicationBuilder app,
|
||||
SiteSettings siteSettings, IHostingEnvironment env)
|
||||
{
|
||||
app.UseFileServer(new FileServerOptions()
|
||||
{
|
||||
FileProvider = new PhysicalFileProvider(
|
||||
Path.Combine(
|
||||
env.WebRootPath,
|
||||
// TODO: add a ressource serveur id here,
|
||||
// or remove the blog entry id usage, to use the userid instead
|
||||
// and an user defined optional subdir.
|
||||
siteSettings.UserFiles.DirName
|
||||
)),
|
||||
RequestPath = new PathString("/" + siteSettings.UserFiles.DirName),
|
||||
EnableDirectoryBrowsing = false
|
||||
});
|
||||
app.UseStaticFiles();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue