if (fileFormat.ToUpper() == "Excel") { Response.ContentType = "application/vnd.ms-excel"; } else if (fileFormat.ToUpper() == "PDF") { Response.ContentType = "application/pdf"; } Response.AddHeader("Content-Disposition", string.Format("attachment; filename = {0}", fi.Name)); Response.AddHeader("Content-Length", fi.Length.ToString()); Response.TransmitFile(fi.FullName); Response.End();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)