具体情况:建立的工程下,Web/Html/AAA/Image  路径下放图片
通过读取指定路径下的图片文件显示到页面getimage.ashx?imageid=xxxx
webconfig中指定相对路径:Web/Html/AAA/Image/
gridview 中模板列有一image控件:
   <asp:Image ID="img_PrdtImage" runat="server" Height="40px" ImageUrl='<%# "../../Html/GetImage.ashx?ImageId=" + Eval("imageid") %>'                                                              Width="40px" />本机调试时显示,但发布后就不显示.
是路径设置不对?如何设置?

解决方案 »

  1.   

    额 ...to   xiaohutushen,连本地调试都不显示图片了三楼,我就是看了路径啊,webconfig中设的相对路径 Web/Html/AAA/Image/ ,(图片路径:http://localhost:4904/Web/Html/GetImage.ashx?ImageId=BBA01A001)调试OK,IIS发布后,图片不显示(http://localhost:4904/Web/Html/GetImage.ashx?ImageId=BBA01A001).
      

  2.   

    额...我找的就是那个,只是我不是直接引用图片路径,而是读服务器端指定路径下的图片文件,用GetImage.ashx显示出来 然后调用显示,用过此方法的高手请指导下,如何读服务器指定路径下的文件
      

  3.   

    额调试是OK的呀,右键属性看的路径也OK,但就是不显示啊
      

  4.   

                string sRelativePath = System.Configuration.ConfigurationManager.AppSettings["RelativePath"];            System.IO.FileStream strmImageData = new System.IO.FileStream(sRelativePath + sImageId + ".jpg", System.IO.FileMode.Open);读文件的,
    发布后输入http://localhost/Web/Html/GetImage.ashx?ImageId=BBA01A001      报错:“/Web”应用程序中的服务器错误。
    未能找到路径“c:\windows\system32\inetsrv\Html\ProductManage\PrdtImage\BBA01A001.jpg”的一部分。
    说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。异常详细信息: System.IO.DirectoryNotFoundException: 未能找到路径“c:\windows\system32\inetsrv\Html\ProductManage\PrdtImage\BBA01A001.jpg”的一部分。源错误:行 55:             string sRelativePath = System.Configuration.ConfigurationManager.AppSettings["RelativePath"];
    行 56:             
    行 57:             System.IO.FileStream strmImageData = new System.IO.FileStream(sRelativePath + sImageId + ".jpg", System.IO.FileMode.Open);
    行 58: 
    行 59:             return strmImageData;
    源文件: c:\Documents and Settings\jicc3120\桌面\web\Html\GetImage.ashx    行: 57