グレート!
ボタンのクリックで多数のレポート (pdf) を実行するレポート スクリプトに取り組んでいます。レポートは Web サーバー上で作成されます。ファイルをダウンロードするオプションをユーザーに提供したいと思います。サーバーから 1 つのファイルをダウンロードするためのスクリプトを作成しました。しかし、複数のファイルをダウンロードする方法がわかりませんか? (たぶん50人くらい)
1 つのレポートを実行した後、ユーザーを http ハンドラー スクリプトにリダイレクトします。
Response.Redirect("Download.ashx?ReportName=" + "WeeklySummary.pdf");
public class Download : IHttpHandler {
public void ProcessRequest(HttpContext context)
{
StringBuilder sbSavePath = new StringBuilder();
sbSavePath.Append(DateTime.Now.Day);
sbSavePath.Append("-");
sbSavePath.Append(DateTime.Now.Month);
sbSavePath.Append("-");
sbSavePath.Append(DateTime.Now.Year);
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ContentType = "application/pdf";
HttpResponse objResponce = context.Response;
String test = HttpContext.Current.Request.QueryString["ReportName"];
HttpContext.Current.Response.AppendHeader("content-disposition", "attachment; filename=" + test);
objResponce.WriteFile(context.Server.MapPath(@"Reports\" + sbSavePath + @"\" + test));
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.End();
}
public bool IsReusable { get { return false; } }
}
事前に感謝します。私のスクリプトをもっと見たい場合はお知らせください。