title: how to generate code for download a music (mp3) in asp.net c#?
body: <p>I have a asp.net webform application (music website).
  I want to have a download button. So when users clicked on that. selected music start to download with browser.How can I do that?</p>
  
  <p>here is the code that I tried:</p>
  
  <pre><code>string id_new;
  id_new = Session["selectedmusicID"].ToString();
  DataTable dt2 = new DataTable();
  dt2 = blm.selectMusic("sel_music", Convert.ToInt32(id_new));
  string test = dt2.Rows[0][9].ToString();
  string test2 = test.Substring(9);
  Context.Response.Clear();
  Context.Response.Buffer = true;
  Context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + test2);
  Context.Response.ContentType = "audio/mp3";
  Context.Response.TransmitFile(@"~\music\" + test2 );
  Context.Response.End();
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/gZazd.png" rel="nofollow noreferrer">see this picture</a></p>