viernes, 3 de enero de 2014

Download file in ASP.NET

    //web.config

    <configuration>
        <appSettings>
             <add key="ruta" value="C:/Cargas/"/>
        </appSettings>

    //webform.aspx

    string lista2 = ConfigurationManager.AppSettings["ruta"].ToString() + "err.txt";
 
    Response.ContentType = "application/txt";
    Response.AppendHeader("Content-Disposition", "attachment; filename=err.txt");
    Response.TransmitFile(lista2);
    Response.End();