FileInfo DownloadFile = new FileInfo(FullFileName);
try
{
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
Response.ContentType = "audio/wav";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.Default));
Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End(); }
catch
{
string msgText = "网络原因,未能下载!";
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ok", "<script>alert('" + msgText + "');</script>");
}
try
{
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
Response.ContentType = "audio/wav";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.Default));
Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End(); }
catch
{
string msgText = "网络原因,未能下载!";
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ok", "<script>alert('" + msgText + "');</script>");
}
byte[] data;
fs.Read(data,0,fs.Length);
Response.Clear();
Response.BinaryWrite(data);