Download and open compressed files

0

Personal I have the following code in an aspx page that compresses files and then downloads them ...

 protected void Page_Load(object sender, EventArgs e)
        {

            try
            {
                JuntarArquivosAprovados(startPath);

                CompactarArquivos();

                DeletarConteudoPasta();

                FileInfo file = new FileInfo(zipPath);

                System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;

                response.ClearContent();
                response.Clear();

                response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name + ";");
                response.WriteFile(file.FullName);
                response.Flush();
                response.Close();


            }
            catch (Exception ex)
            {
                throw ex;
            }


        }

It downloads the compressed files right away ... but when I go to open I get the message that the files are damaged and it does not open ... I have another project that uses the SAME code in a WebService (asmx) and I can open those files quietly ... Anyone have any idea why this?

    
asked by anonymous 28.12.2015 / 21:13

0 answers