public void DataXY()
    {
        string mapPath = HttpContext.Current.Server.MapPath(@"~/images/大坝.jpg");
        System.Drawing.Bitmap image = new Bitmap(mapPath);        using (Bitmap img = new Bitmap(image))
        {
            using (Graphics g = Graphics.FromImage(img))
            {
                try
                {
                    //画图片的背景噪音线
                    foreach (Model.Eqpmentlocation model in bll.GetList())
                    {
                        locaX = model.LocationX; //绘制X坐标
                        locaY = model.LocationY;  //绘制Y坐标
                        g.DrawRectangle(new Pen(Color.Blue), locaX, locaY, 3, 3);
                    }
                    img.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
                    //this.Literal1.Text = "Imgvalue=\"" + img + "\";";
                    //Response.Write("whwhwwhi");
                    Response.Write(img);
                    ImagesWifi();
                    Response.End();
                }
                finally
                {
                    g.Dispose();
                    image.Dispose();
                }
            }
        }
    }

解决方案 »

  1.   

    你这是以流的方式输出的,直接在当前页面不行,除非你输出的是图片格式。你就把这个整个页面看成是图片,到你要引入这个图片的页面上加个img标签,然后把路径给这个页面即可(就跟图片验证码一样),建议路径后缀加个时间戳以防页级缓存
      

  2.   

    新建一个ashx,用于生成并Reponse图片。
    img 的src 链接指向 ashx
      

  3.   

    eg:<img alt="" src='<%=string.Format("../Control/validate.aspx?ptime={0}", DateTime.Now.Millisecond.ToString()) %>' id="getcode_img" title="看不清请点击!" />
      

  4.   

    参考下面相关:
    http://www.cnblogs.com/insus/archive/2013/05/16/3081055.htmlhttp://www.cnblogs.com/insus/archive/2013/02/05/2892678.htmlhttp://www.cnblogs.com/insus/archive/2011/04/02/2003740.html
      

  5.   

    <img src="输出图片的页面.aspx" />