public async Task<FileResult> DownLoad(string name)
{
var path = Server.MapPath("~/Templates/") + name;
using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 4096, FileOptions.Asynchronous))
{
byte[] data = new byte[fs.Length];
await fs.ReadAsync(data, 0, data.Length);
return File(data, "application/octet-stream", name);
}
}