私の目的は、ajax POSTコールの後にExcelファイルをダウンロードすることです。これまで私は、私が望むExcelファイルを生成するこのエンドポイントを持っています:.NETでのajaxポストコールの後にファイルをダウンロード
[HttpPost]
public ActionResult ExportReportList(ReportFilterViewModel filter, RequestedPageInfo pageInfo)
{
IEnumerable<RtbReport> rtbs = null;
// get collection of page view entities to supply to the exporter
rtbs = RtbReportRepository.GetReport(filter).ToList();
// put in default values for null-valued numberic fields
rtbs = rtbs.ToList()
.Select(s =>
{
s.AdvertiserId = s.AdvertiserId ?? 0;
s.CampaignId = s.CampaignId ?? 0;
s.RtbCampaignId = s.RtbCampaignId ?? 0;
s.CapLoss = s.CapLoss ?? 0.0M;
s.GrossRevenue = s.GrossRevenue ?? 0.0M;
s.GrossProfit = s.GrossProfit ?? 0.0M;
s.GrossProfitPerc = s.GrossProfitPerc ?? 0.0M;
return s;
});
// export the report as an XLS binary format
byte[] output = GetReportListExcel(rtbs);
// export as an excel MIME type
return File(output, "application/vnd.ms-excel", "RtbReport.xls");
}
私はこのファイルをダウンロードします。 RtbReport.xlsのダウンロードを促すために私が打つべき道は何ですか?私が調べた答えの中から、多くはwindow.locationを使い、ファイルへのパスを指定しました。しかし、私の人生はファイルがどのような経路にあるのか理解できません。