I am working on a test asp .net app and wanted to test out making a background image. I put the Image file (Background.jpg) in a folder called images and placed it in the home folder of the view where my index.cshtml file is located then i edited the cshtml file to:
<img src="images/Background.jpg" alt="Sample Photo" />
It only shows the alt solution The chrome command windows gives me this error:
(red X)GET https://localhost:XXXX/images/Background.jpg 404
CodePudding user response:
Static files are stored within the project's web root directory.And the default directory is {content root}/wwwroot
, You can refer to the official
Then try to use:
<img src="~/images/Background.jpg" alt="Sample Photo" />