I have an app in .Net Core 3.1 and Angular 10.
In my Startup.cs, I have the folowing code:
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath,"Pictures")),
RequestPath = new PathString("/Pictures")
});
The files are saved into the correct path but when I want to display them from web with the path:
http://mywebsite/Pictures/pic.jpg, I just get a:
without errors, no 404 or 401.
Can someone help?
Thanks.
I solved the problem:
In my controller I wrote an absolute path: C:...
I changed to environment.ContentRootPath and it works.
Thanks for the answers.