At server tried this
Response.TransmitFile(reportPath);
Response.End();
//Response.Flush();
//Response.Close();
Now it isworking fine.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
downloading excel from server showing me failed network error in chrome browser and in firefox showing error as below
C:\Users\Sunil\Downloads\Pr8zzTpI.xlsx.part could not be saved, because the source file could not be read.
I am using epplus lib for generating excel , i see excel has been generated in a folder but not able to download it.
here is my code.
private void DOWNLOAD_FILE()
{
try
{
if (!string.IsNullOrEmpty(Request.QueryString["reportPath"]) && !string.IsNullOrEmpty(Request.QueryString["FileName"]))
{
string reportPath = Request.QueryString["reportPath"];
string FileName = Request.QueryString["FileName"];
logerrors.logerror("reportPath " + reportPath);
logerrors.logerror("FileName " + FileName);
Response.ClearContent();
Response.Buffer = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", FileName));
Response.TransmitFile(reportPath);
//Response.End();
Response.Flush();
Response.Close();
}
else
{
logerrors.logerror("Invalid Report Path Or ReportName");
}
}
catch (Exception ex)
{
logerrors.logerror(ex.Message);
}
}
At server tried this
Response.TransmitFile(reportPath);
Response.End();
//Response.Flush();
//Response.Close();
Now it isworking fine.