protected void ExportXLSBtn_Click(object sender, EventArgs e) { SponsorsReport p = GetReport(); string format = "xls"; string fileName = String.Format("Report.{0}", format); MemoryStream ms = new MemoryStream(); p.ExportToXls(ms); Response.Clear(); Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", String.Format("{0}; filename={1}", "attachment", fileName)); Response.BinaryWrite(ms.ToArray()); Response.Flush(); Response.Close(); //Response.Redirect("Reports/RT301.aspx"); }