假如本地的路径是D:/111.jpg,我要在一个页面pic.aspx里就显示这个图片,要用流的方式显示,
就是stream读取图片,再用流的方式显示出来,不能<img src='d:/111.jpg' />这种方式肯定不行的,不知道怎么写了。谢谢大家。

解决方案 »

  1.   

    <div>
      <% this.Response.WriteFile("d:/111.jpg");%>
    </div>
      

  2.   


            byte[] pic = System.IO.File.ReadAllBytes(yourpicpath);
            context.Response.Buffer = true; 
            context.Response.Clear();// 清除缓冲区所有内容
            context.Response.ContentType = "application/octet-stream";
            //context.Response.Write();
            //context.Response.AddHeader("Content-Disposition", "attachment;filename=" + "a.jpg");                     
            context.Response.BinaryWrite(pic);
            context.Response.Flush(); 
            context.Response.End();     
      

  3.   

    使用*.ashx,有什么好处呢,用aspx也可以吧?
      

  4.   

    楼上的,又遇到新问题了。你的代码如果是本地图片是可以的。可是如果是网络上的图片就不行。
    报错是不支持 URI 格式请问这个该怎么弄呢,?
      

  5.   

    http://topic.csdn.net/u/20091211/16/ef598a88-0da3-4657-b6b9-8579db745d18.html
      

  6.   

    图片保存在相对路径
    否则使用activex获取图片输出流