In mvc .net c# i have over loaded OnException action in my base controller
In controller action I have generated zip file using Ionic.Zip.dll
The code for this is like
foreach (var file in filesToarchive)
{
zip.AddFile(@file.FilePath);
}
zip.Save(Response.OutputStream);
var rept = reports.First();
return File(Response.OutputStream, "plain/zip", "abc.zip");
While downloading the file it throws exception in OnException action in base controller
the exception is :
System.Web.HttpResponseStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.Web.Mvc.FileStreamResult.WriteFile(HttpResponseBase response) at System.Web.Mvc.FileResult.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.<>c_DisplayClass14.b_11() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass14.<>c__DisplayClass16.<InvokeActionResultWithFilters>b__13() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList
1 filters, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
If anybody has any solution then please give it to me.
Thanks