# 3.后端
```csharp
HttpContext.Current.Response.AddHeader("Content-Transfer-Encoding", "binary");
HttpContext.Current.Response.ContentType = "application/octet-stream;charset=UTF-8";
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
using (FileStream fileStream = new FileStream(HttpContext.Current.Server.MapPath(savepath), FileMode.Open, FileAccess.Read))
{
byte[] buffur = new byte[fileStream.Length];
fileStream.Read(buffur, 0, (int)fileStream.Length);
HttpContext.Current.Response.AppendHeader("content-disposition",
"attachment;filename=" + HttpUtility.UrlEncode("filename", Encoding.UTF8));
HttpContext.Current.Response.BinaryWrite(buffur);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
}