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!
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"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.