I'm trying to send this file to the outputstream but cannot figure out why it spits out basically an empty mp3 file. As you can see I would get an exception closing the stream prematurely so I have commented out for now. Any pointers appreciated.
using (FileStream mp3file = File.OpenRead(newFile))
{
context.Response.AddHeader("content-transfer-encoding", "binary");
context.Response.ContentType = "audio/mpeg";
MemoryStream memStream = new MemoryStream();
byte[] bytes = new byte[mp3file.Length];
memStream.SetLength(mp3file.Length);
mp3file.Read(memStream.GetBuffer(), 0, (int)mp3file.Length);
memStream.Write(bytes, 0, (int)mp3file.Length);
//mp3file.Close();
memStream.WriteTo(context.Response.OutputStream);
//memStream.Close();
}