Datagrid中为文件连接,点击后从Sql Database中进行文件下载,但下载后框架页面不正常,请问如何恢复到下载前的状态。
使用Response.Flush()后对网页产生什么影响?

解决方案 »

  1.   

    protected void Download()
    {
      string  fileName;
      byte[] buffer;
      
      buffer = GetData(ref fileName);//函数返回byte[],从数据库中读取image字段到byte[]中,并返回文件名
      Response.Append();
      Response.ContentType = "application/octet-stream";
      Response.AddHeader("Content-Disposition", "attachment;FileName="+HttpUtility.UrlEncode(fileName,Encoding.UTF8 ));
      Response.AddHeader("Content-Length",fileSize.ToString()); 
      Response.BinaryWrite(buffer);
      Response.Flush();  
    }
      

  2.   

    Response.Append();去掉,粘贴错误