0

Before everyone marks this as duplicate, I did follow these suggestions: CSS images not showing in ASP.NET MVC Images Not Showing in MVC and several others.

This is my code:

     <img src="~/App_Data/complogo.jpg" class="rounded float-right" alt="complogo">

Which works in asp.net, but not in a MVC project. The jpg is located in the folder App_Data in the project folder. I tried changing the type of image, but not one image works. When running the project I get that 'broken' image and when hovering the mouse over it tells me 'complogo' as the alt name. I also went into F12 on Chrome, and it says 404 not found. So what am I doing wrong here ?

someone13
  • 51
  • 1
  • 1
  • 11

1 Answers1

2

As explained in this answer the App_Data folder is special and images etc.. in this folder will not be rendered.

Add a separate folder like /Content/Images/ or just /Images to your project and serve your images from there.

CobyC
  • 1,784
  • 1
  • 16
  • 21