DMop
DMop

Reputation: 483

Images Not Appearing Asp.Net Core

I am attempting to use imported images in my .Net Project. I have placed the images in the images folder and they all have a plus sign and say "Pending add" next to them.

I'm not sure if this is the error or how I am referencing the images. I reference the image using the following code.

<img class="block" id="u730_img" src="Images/green9-crop-u730.jpg?crc=200722682" alt="" width="1529" height="659"/>

The image name is correct, but I'm not sure if that is the appropriate path. My folder structure is below. The file being used is LoginBody.cshtml and the image is in the images folder.

enter image description here

Upvotes: 6

Views: 11668

Answers (1)

Divyang Desai
Divyang Desai

Reputation: 7866

I suspect that you're using ASP.NET Core, and in newer version static files under wwwroot folder are served.

Move your images to wwwroot > images and change your path:

<img class="block" id="u730_img" src="~/Images/green9-crop-u730.jpg?crc=200722682" alt="" width="1529" height="659"/>

Hope this helps !

Upvotes: 15

Related Questions