简体   繁体   English

在Windows Server2008 R2中将src设置为本地文件时,图像地址(URL)不可用

[英]Image Address (URL) Not Available when Setting src to local file in windows server2008 R2 64

I am having a problem setting an image's source property to refer to a local file when running the application under Windows 2008R2 64. 在Windows 2008R2 64下运行应用程序时,将图像的源属性设置为引用本地文件时遇到问题。

The application is running normally on 2008, XP and Win7, but when running the application under 2008R2 64 no image is displayed. 该应用程序可以在2008,XP和Win7上正常运行,但是在2008R2 64下运行该应用程序时,不会显示任何图像。 Checking the source of the Page in IE and Chrome I can see the src property points to the correct location, but if I right click the image and view its properties all properties are Not Available. 在IE和Chrome中检查Page的来源,我可以看到src属性指向正确的位置,但是如果我右键单击图像并查看其属性,则所有属性都不可用。

Select Tools - Internet options - Security Select Internet zone, if it's not already selected Click the Custom level ... box In the Settings window, scroll down to Display mixed content and select Enable Click OK twice to close out the dropdowns 选择工具 -Internet选项 - 安全选择Internet区域(如果尚未选中)单击“ 自定义级别 ...”框在“设置”窗口中,向下滚动至“ 显示混合内容”,然后选择“ 启用”,单击“ 确定”两次,以关闭下拉菜单

Hold shift and click refresh to see if it works? 按住shift键并单击“刷新”以查看是否有效?

First off, is the tag not <img src...> ? 首先,标记不是<img src...>吗? You said SCR so I just wanted to make sure you'd typed SCR on purpose or if that was a typo... 您说的是SCR,所以我只想确保您故意输入SCR,或者这是一个错字...

I've had the same problem debugging my websites in Visual Web Developer... The image tags all look right, I've even copied the source text (the address of the image) as reported by VWD without any improvement. 我在Visual Web Developer中调试我的网站时遇到了同样的问题...图像标记看起来都不错,我什至还复制了VWD报告的源文本(图像的地址),没有任何改善。

What I found was that the problem had to do with how I was specifying the path. 我发现问题出在我指定路径上。 I prefer to use absolute paths from the web root, but it seems like some software doesn't like that, try a relative path from the page you're working on: 我更喜欢从Web根目录使用绝对路径,但是似乎有些软件不喜欢这样,请尝试从您正在处理的页面获取相对路径:

So instead of: 所以代替:

<img src="~/Images/header.png">

Use 采用

<img src="../Images/header.png">

HTH 高温超导

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM