我正在为 asp.net 网站将图像存储在本地主机上的一个文件夹中。
图像存在并且 src 属性格式正确,但图像未显示在 img 元素中。
有人能告诉我可能是什么问题或遗漏了什么吗..当我检查浏览器 url 中的图像时,它显示正确
localhost:xxxx/TenModified/setX/8fd7976b-d4b0-467a-bc3e-bf2a51d60299.Jpeg
这是我对元素的标记
<img id="ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolderChild_ListViewThumbs_ctrl1_ctl03_Image1" src="localhost:59657/ProfileTenModified/setP/8fd7976b-d4b0-467a-bc3e-bf2a51d60299.Jpeg" style="border-width:1px;border-style:Solid;height:172px;width:172px;" alt="">
最佳答案
您不需要包含域和端口。以下内容适用于 src:
/ProfileTenModified/setP/8fd7976b-d4b0-467a-bc3e-bf2a51d60299.Jpeg
或完整标签:
<img id="ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolderChild_ListViewThumbs_ctrl1_ctl03_Image1" src="/ProfileTenModified/setP/8fd7976b-d4b0-467a-bc3e-bf2a51d60299.Jpeg" style="border-width:1px;border-style:Solid;height:172px;width:172px;" alt="" />
关于asp.net - 图片src属性问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15838848/