英文:
Add image to ASP.NET MVC project
问题
如何将现有图像添加到我的ASP.NET MVC项目中?当我直接从Google复制URL时,图像未显示,但当我将其保存到我的计算机,然后尝试添加它时,它不起作用。
我已经尝试过这段代码
<i>
<img src="C:\filename.txt\WebApplication3\WebApplication3\Images\cars.jpg" class="card-img" alt="..." >
</i>
英文:
How can I add an existing image to my ASP.NET MVC project? The image is not being displayed, it works fine when I copy the url directly from Google, but when I save it to my PC and then try to add it, it doesn't work.
I've tried this code
<i>
<img src="C:\filename.txt\WebApplication3\WebApplication3\Images\cars.jpg" class="card-img" alt="..." >
</i>
答案1
得分: 1
我找到了我需要的答案,"将您的图像移到wwwroot文件夹并使用~/cars.jpg,因为ASP.NET Core仅从wwwroot文件夹获取静态文件。谢谢!
英文:
i found the answer i needed, "Move your image into wwwroot folder and use ~/cars.jpg, because ASP.NET Core gets static files from only wwwroot folder. Thanks!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论