FileInfo _file = new FileInfo(file); if (_file.Exists) { Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=" + _file.Name); Response.AddHeader("Content-Type", "application/Excel"); Response.ContentType = "application/vnd.xlsx"; Response.AddHeader("Content-Length", file.Length.ToString()); Response.WriteFile(_file.FullName); Response.End(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)