我有这个代码

private void writeReport(IReport report, string reportName)
{
    string reportString = report.makeReport();
    ASCIIEncoding encoding = new ASCIIEncoding();
    byte[] encodedReport = encoding.GetBytes(reportString);
    Response.ContentType = "text/plain";
    Response.AddHeader("Content-Disposition", "attachment;filename="+ reportName +".txt");
    Response.OutputStream.Write(encodedReport, 0, encodedReport.Length);
    Response.End();
}

但我有3个文件,我需要发送给客户。我宁愿没有使用者点击3按钮,让他们在3txt文件。有没有一种方法,发送所有3个反应?

有帮助吗?

解决方案

不,多附件下载(如在电子邮件),不支持出于安全考虑。它被称为“偷渡式下载”。

请注意,Gmail的通过动态压缩和解了文件处理此。你应该也。 http://forums.asp.net/t/1240811.aspx

其他提示

这可以通过根据本条"下载文件的一个http请求"在 motobit.com.

但是它不如何HTTP设计和以下这些步骤可能会破坏在任何时间取决于客户和服务结构。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top