Reputation: 11
I am trying to display an image for a gallery page I am creating. I'm very new to ASP.NET Core MVC. I saved the image in the same folder that my project is in.
This is what I have in my view file:
@{
ViewData["Title"] = "Gallery";
}
<h2>Gallery Page</h2>
<img src="myImage.jpg" height="113" width="113" border="0" />
This is my gallery function in my controller:
public IActionResult Gallery()
{
return View();
}
Thank you for any help!
Upvotes: 1
Views: 2864
Reputation: 239
In the img src you have directly gave the image name instead of create a new image folder and add the image file into that folder. change the html code as given below.
<img src="~/Folder Name/myImage.jpg" height="113" width="113" border="0" />
Upvotes: 2