I have an asp.net mvc action that returns an xls file:
public void Excel(string filename) { DAOSolicitacao dao = new DAOSolicitacao(); System.Threading.Thread.Sleep(5000); var products = dao.GetSolicitacoes(); var grid = new GridView(); grid.DataSource = products; grid.DataBind(); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", filename)); Response.ContentType = "application/ms-excel"; Response.Charset = ""; StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); grid.RenderControl(htw); Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); }
How can I make this xls file return into an zip file ?