Author: enriquevald | Posted on: 10/10/2009 6:24:32 AM | Views : 261

I would like to download a mp3 file from my server. I m using the code below for do that but the mp3 file is not downloaded complete.


//Initialize the input stream HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); //Initialize the output stream Response.Clear(); Response.AppendHeader("Content-Disposition:", "attachment; filename=" + Server.UrlPathEncode(pista.Nombre.Trim().Replace(" ", "")) + ".mp3"); Response.AppendHeader("Content-Length", resp.ContentLength.ToString()); Response.ContentType = "audio/mpeg3"; Stream rs = resp.GetResponseStream(); byte[] ByteBuffer = new byte[resp.ContentLength]; rs.Read(ByteBuffer, 0, ByteBuffer.Length); Response.Bi ...

Go to the complete details ...