把它直接放在内存中,然后传给客户端

// 创建MemeoryStream
System.IO.MemoryStream ms = new System.IO.MemoryStream();

// 写dataset到MemeoryStream

dataset1.WriteXml(ms,System.Data.XmlWriteMode.IgnoreSchema);

 

Response.Clear();

// 下载附件的名字

Response.AddHeader("Content-Disposition", "attachment; filename=Acounts.xml");

// 下载附件的大小,以便让浏览器显示进度条

Response.AddHeader("Content-Length", ms.Length.ToString());

// 指定浏览器为下载模式

Response.ContentType = "application/octet-stream";

// 发送到客户端

byte[] b = ms.ToArray();

Response.OutputStream.Write(b,0,b.Length);

Response.End();

}

相关文章:

  • 2021-12-15
  • 2021-08-31
  • 2022-02-08
  • 2021-12-29
  • 2022-12-23
  • 2021-06-06
  • 2021-08-28
  • 2021-09-25
猜你喜欢
  • 2021-06-09
  • 2021-05-20
  • 2021-10-24
  • 2022-12-23
  • 2021-11-13
相关资源
相似解决方案