我设置了ViewBag
,View
中没有显示。以下是我的代码: -
Response.BufferOutput = false;
Response.ContentType = "application/zip";
Response.AddHeader("content-dispostion", "filename=text.zip");
Response.Charset = "";
using (ZipFile zip = new ZipFile())
{
foreach (var item in List)
{
zip.AddFile(Server.MapPath("~/" + item.Code.ToString() + ".pdf"), "/");
}
zip.Save(Response.OutputStream);
}
Response.Close();
ViewBag.Message = "Success";
return View();
如果我comment
Response
代码&只需设置ViewBag
& return View()
然后ViewBag
显示View
值。
如何在ViewBag
之后获得Response.Close()
的价值?