Hi, I got error when I tried to join two files mp3 in ASP.NET C#
'System.IO.Stream' does not contain a definition for 'WriteTo'
How to fix that error? please help
Here is my codes:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.IO;
using System.Text;
public partial class mp3Manager : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e) {
Response.Clear();
Response.ContentType = "audio/mpeg";
Response.AddHeader("Content-Disposition", "attachment; filename=1.mp3");
WriteBytesToResponse(System.IO.File.ReadAllBytes(@"C:\inetpub\wwwroot\mp3\1.mp3"));
WriteBytesToResponse(System.IO.File.ReadAllBytes(@"C:\inetpub\wwwroot\mp3\2.mp3"));
Response.End();
}
private void WriteBytesToResponse(byte[] sourceBytes) {
using (Stream sourceStream = new MemoryStream(sourceBytes, false)) {
sourceStream.WriteTo(Response.OutputStream);
}
}
}