Response.Close问题后的ViewBag值

时间:2015-02-27 08:30:36

标签: c# asp.net-mvc asp.net-mvc-4 response viewbag

我设置了ViewBagView中没有显示。以下是我的代码: -

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()的价值?

0 个答案:

没有答案