User711641945 posted
Hi elahi1mahdi,
Be sure the image(ed5f0a69-9154-4939-9918-993548faa05f.JPG) located in the
`wwwroot/Files/Products/Thumb` folder.
And be sure the UseStaticFiles middleware call before routing:
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
If the image does not locate in the default wwwroot folders,it locates in the `Files/Products/Thumb` folder.
Configure your middleware like below:
//app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(env.ContentRootPath, "Files")),
RequestPath = "/Files"
});
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
Reference:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-3.1
Best Regards,
Rena