【问题标题】:Image src firefox not showing, absolute path图像 src firefox 未显示,绝对路径
【发布时间】:2012-07-06 09:53:44
【问题描述】:

ASP.NET 应用程序

我对显示图像有些困惑。加载 img 时 IE 完全正常工作。 Firefox 不在生产服务器上显示图像。

生成的img url在服务器上:

\chartings\charts\temp/generatedchart_img.jpg

我注意到当我在 localhost publish 上运行时会翻转 src url:

/chartings/charts/temp\generatedchart_img.jpg

非常感谢任何建议。 谢谢

【问题讨论】:

    标签: html path image absolute


    【解决方案1】:

    我认为网址应该只有正斜杠:

    /chartings/charts/temp/generatedchart_img.jpg
    

    【讨论】:

    • 我认为当 Firefox 找到 \ 时,它认为这是文件名的一部分,而不是文件夹中断,因此它会在文件夹 /chartings/charts/ 内查找文件 temp\generatedchart_img.jpg
    • 感谢您的回答,我的网址是从后面的 c# 代码生成的。 this.txtChartImageFilename.Value = this.chartings+ @"\" + csiChart.FileManager.FileName + ".jpg"; this.chartings 是/chartings/charts/temp。为什么它可以在 IE 中运行?它会转换反斜杠吗?
    • 我不知道为什么 IE 剂量它剂量...但是在你的代码中你添加一个`\`第一步是将this.txtChartImageFilename.Value = this.chartings+ @"\" + csiChart.FileManager.FileName + ".jpg"; 更改为this.txtChartImageFilename.Value = this.chartings+ @"/" + csiChart.FileManager.FileName + ".jpg";
    猜你喜欢
    • 1970-01-01
    • 2014-06-23
    • 1970-01-01
    • 2011-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多