protected void LinkButton1_Click(object sender, EventArgs e) { try { DataSet objSuccFailDataSet = (DataSet)Session["objSuccFailDataSet"]; string sFileDir = Convert.ToString(Session["sFileDir"]); //string strOutputExcelFile = Convert.ToString(Session["sFileName"]); string strOutputExcelFile = Convert.ToString(Session["strOutputExcelFile"]); bool retflagTmp = ExportToExcelTemp(objSuccFailDataSet, sFileDir + strOutputExcelFile); if (retflagTmp) { Response.ContentType = "application/ms-excel"; Response.AddHeader("content-disposition", "attachment; filename=" + strOutputExcelFile); FileStream sourceFile = new FileStream(sFileDir + strOutputExcelFile, FileMode.Open); long FileSize; FileSize = sourceFile.Length; byte[] getContent = new byte[(int)FileSize]; sourceFile.Read(getContent, 0, (int)sourceFile.Length); sourceFile.Close(); Response.OutputStream.Write(getContent, 0, getContent.Length); // Response.BinaryWrite(getContent); Response.Flush(); Response.End(); // File.Delete(sFileDir + strOutputExcelFile); } else { lblMessage.Text = "Error in writing the Excel Report."; } } catch (Exception ex)>>>empty file path { string strMsg = ex.Message; objError.SaveError("UploadFiles", MethodBase.GetCurrentMethod().Name, ex.Message + ex.InnerException); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)