Try creating the images subfolder of wwwroot and move here the logo.png file.
Then use <img src="~/images/logo.png"/>.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am having some trouble displaying an image in an ASP.NET MVC application. See below screen grab which shows the code I am using and the folder structure.
So I am using <img src="~/Content/Images/logo.png" /> to display the logo.png found in the Content/Images directory.
It does not display and I get the broken image icon.
I have app.UseStaticFiles(); in my Program.cs file
If anyone can help it would be appreciated.
Try creating the images subfolder of wwwroot and move here the logo.png file.
Then use <img src="~/images/logo.png"/>.
You have to specific your static file location.
app.UseStaticFiles(new StaticFileOptions(){
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"Content/Images")), RequestPath = new PathString("/Content/Images")});