把它直接放在内存中,然后传给客户端
// 创建MemeoryStream
System.IO.MemoryStream ms = new System.IO.MemoryStream();// 写dataset到MemeoryStreamdataset1.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();}