I have set a ViewBag
, which is not displayed in View
. Following is my code :-
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();
If I comment
the Response
Code & Just set ViewBag
& return View()
then ViewBag
value is displayed in View
.
How to get value of ViewBag
after Response.Close()
?