How can I get the user to download an Excel file that is in a virtual path?

0

This is what I have tried, it finds it and everything but it is not downloaded anywhere

 protected void btn_Exc_Click(object sender, EventArgs e)
        {
            System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
            Response.ContentType = "xlsx";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.AppendHeader("NombreCabecera", "MensajeCabecera");
            Response.TransmitFile(Server.MapPath("~/Archivos/DOCUMENTOS_ADJUNTOS/Formato_Programacion/Formato_Programacion.xlsx"));
            Response.Flush();
            Response.End();
        }
    
asked by Camilo Gomez 07.09.2018 в 21:00
source

0 answers