It is possible to do so. I've been working on this thing for two weeks now, looked everywhere to get an answer. Here is how I did it.
You will need to add in the configure app.UseFileServer() in the Configure method of the Startup.cs
app.UseFileServer(new FileServerOptions
{
PhysicalFileProvider("\\\\virtualPath\\photos\\wait\\"),
RequestPath = new PathString("/AROULETTE"),
EnableDirectoryBrowsing = true
});
How does this work?
The way it is set up, you would enter http://localhost:5000/AROULETTE
and it would open the virtual path provided in the PhysicalFileProvider in the browser. Of course this is not what I actually wanted.
I needed to create a directory and copy files into the virtual directory with C#.
Once I had the FileServer setup, I tried something like this which does not work.
if(!Directory.Exists("/AROULETTE/20170814"))
{
Directory.Create("/AROULETTE/20170814")
}
of course, neither does this
var path = Path.Combine("http://localhost:5000/", "AROULETTE/20170814")
if(!Directory.Exists(path)
{
Directory.Create(path)
}
Instead, you just use the actual virtual path of the folder.
if(!Directory.Exists("\\\\virtualPath\\photos\\wait\\20170814"))
{
Directory.Create("\\\\virtualPath\\photos\\wait\\20170814")
}
Thus UseFileServer is used to create a "bridge" between the application and the virtual folder the same way that you would create a virtual directory with ASP.Net 4.5
Hope this can help some people because most of the answers about this topic were not clear at all.